Conor Sammon scored a last-minute winner as Derby boss Steve McClaren led the Rams to victory against his former club Middlesbrough.
Boro played most of the match with 10 men after Curtis Main received two bookings, and they went behind when Chris Martin prodded home.
Dean Whitehead lashed in an unlikely equaliser with 16 minutes left after fine work from Mustapha Carayol.
But the Rams pinched it when Sammon latched onto a bouncing ball to score.
Rise of the Rams
Derby's fourth straight win lifts Steve McClaren's side to fourth in the Championship table. When the former England boss took over at Pride Park, the Rams were 14th.
McClaren, in his first managerial game against his old club, saw his new team emerge somewhat fortunate victors as the Rams extended their winning run to four matches.
After a slow start, the pendulum swung Derby's way in the 33rd minute when Boro striker Main left his foot in on Rams defender Jake Buxton and was shown a second yellow card.
Boro's Albert Adomah then had a shot saved after a fine solo run, before Derby took the lead in first-half stoppage time when Craig Bryson's low cross was converted by the sprawling Martin.
The visitors levelled when Carayol ran the length of Derby's half and cut the ball back to Rhys Williams, whose effort rebounded for Whitehead to drive home his first goal for the club.
Derby struggled to muster a response, but they snatched victory at the death when Sammon beat stranded Boro keeper Shay Given to end a gritty rearguard action.
Derby boss Steve McClaren:
"It's three points. That's it. It was not a good performance by our normal standards.
"The Championship is tough and there are different ways you have to win. We won it despite not playing our usual brand of football and we were disappointing in that.
"I wouldn't say we were lucky as we kept our patience. We waited for the moment and took it. They're the kinds of things teams have if they're going to be successful."
Middlesbrough head coach Aitor Karanka:
"To concede goals at the end of both halves, we felt bad. I saw I have a team that is together, everyone was helping each other and fighting the same battle and I was very happy about that.
"It was very encouraging. When you lose the way we did, you cannot really say anything to the players.
"I would like to know why (Main) was sent off. If he deserved two yellow cards, then you would be ending every game with six or seven players."
Derby County 01 Grant 33 Wisdom 03 Forsyth 14 Eustace (Hendrick - 45' ) 06 Keogh 25 Buxton 04 Bryson (Sammon - 79' ) 19 Hughes 09 Martin 32 Dawkins (Russell - 76' ) 10 Ward Substitutes 08 Hendrick 11 Russell 18 Sammon 20 Bennett 26 Legzdins 34 Cissé 35 Keane Middlesbrough 12 Given 04 Williams Booked 03 Friend (Ayala - 92' ) 06 Butterfield (Carayol - 45' ) 39 Woodgate 22 Gibson 27 Adomah (Varga - 87' ) 18 Whitehead 23 Main Dismissed after an earlier booking 33 Smallwood 29 Kamara Substitutes 05 Richardson 08 Varga 10 Emnes 11 Ledesma 13 Konstantopoulos 19 Carayol 26 Ayala
Ref: Andy Madley