Ten-man Boro almost plundered a point as they clawed from behind at Derby only to concede last-gasp sickener and lose 2-1.
They were up against it after striker Curtis Main got sent off to leave Boro a man down for the second successive away game – then to add insult to injury, Chris Martin put Derby ahead just before the break.
But Boro looked to have salvaged a precious point after Dean Whitehead stabbed home – only for Connor Sammon to pounce in the 90th minute after poor defending.
Derby have now lost just one game in nine since former Boro boss Steve McClaren took charge.
Boro weathered away some insistent early Derby pressure and twice had to scramble away from inside the box after good moves sparked by teenager Hughes.
But the Teessiders won a corner on the right and the kick was played to the edge of the box for Albert Adomah, whose dipping shot towards the far post was headed away by defender Keogh.
Derby pressed on 13 minutes as a high ball was knocked down the inside right channel towards Martin but Ben Gibson twice nodded the ball high in the air then put in a diving header to send it safely back to Boro keeper Shay Given.
Derby almost broke through on 21 minutes as Ward nut-megged Friend; the full-back hauled him down right on the edge of the box but the ref waved play on.
Boro almost broke through on 25 minutes as Whitehead neatly flicked a diagonal ball behind the defence for Kamara to run on to but his first-time effort screamed over.
Boro went close on 29 minutes as Butterfield chipped a free-kick to the far post and when Friend nodded it back, Kamara connected with an acrobatic airborne volley that flew just outside the near post.
Derby threatened on 32 minutes as full-back Forsyth wriggled past Adomah to get down the left to drill in a low cross that Given did well to scoop away; when it fell to Hughes he sent his half-volley high over.
Boro were down to 10 men on 34 minutes as Curtis Main crashed into Buxton to collect his second yellow.
Boro went close on 40 minutes as a quick Butterfield ball sent Adomah down the right and he cut inside to drill a low angled shot that brought a good save at the near post.
But Derby snatched the lead seconds into stoppage time as Bryson whipped a cross to the near post where Chris Martin stretch to just get a touch on the ball – with suggestions of hand-ball – ahead of a brave attempted blocking header by Gibson and it squirted in.
Derby showed first after the break as a ball from Forsyth found Martin in the crowd and he sent a overhead kick high and wide.
Boro hit back when Friend raced down the left and crossed to the far post for Kamara to send a looping header into the hands of Grant.
But the Rams were using their extra man wisely and pushing the ball out wide to stretch Boro and the ten men were having to work hard.
Derby went close on 66 minutes as Dawkins crossed to the far side where unmarked Ward leathered a shot goalwards, but Given saved.
And then Boro broke out of defence to score a leveller.
Carayol streaked forward then squared for Smallwood who lost control but the loose ball rolled for Whitehead to lash home.
But Derby snatched victory in the last minute as a ball was flicked into the box and was nodded down, with Sammon bundling it home.