Derby County edged away from the relegation zone after a last-minute header by Leroy Lita made it 2-2 and prevented Middlesbrough losing a game they had controlled for most of an eventful night at Pride Park.
Barry Robson's fifth goal in seven games put Boro in charge but Derby turned the contest around through Chris Porter and Michael Tonge before Lita pounced after Rhys Williams had been sent off.
Derby were desperately poor in the first half although Rob Hulse was close to adding to his 11 goals in the tenth minute. The striker found space on the left edge of the Boro box and drove in a right-foot shot which Danny Coyne palmed away.
The visitors also looked far from convincing but they went ahead in the 15th minute through another great strike by Robson. A cross from Andrew Taylor was headed out by Nicky Hunt but Robson volleyed it past David Martin from 15 yards.
Derby's best chance of a response came when they got the ball wide and Gilles Sunu forced David Wheater into a foul near the touchline in the 39th minute which earned the defender a booking.
But Derby made little impression on the Boro defence and it was the visitors who came close to increasing their lead early in the second half when Shaun Barker had to throw himself in the way of a close-range blast from Williams.
The visitors did have the ball in the net in the 58th minute when Martin could not hold a Chris Killen shot but Scott McDonald was offside before he turned in the rebound.
Derby replaced Robbie Savage in the 63rd minute with Porter and the move paid off four minutes later when he put his team level.
Jay McEveley got behind the defence and delivered a cross which Coyne could only palm behind him and Porter headed in at the back post.
It was a different game now and Derby went ahead in the 74th minute when Boro could only half-clear a cross and Tonge beat Coyne with a 20-yard volley.
Boro were dealt another blow in the 88th minute when Williams was shown a second yellow card for a late lunge on Leacock but they had the last word when Lita rescued a point.
Derby were caught out by a free-kick to the back post and Lita was the first to react to head in a goal which keeps his team in the chase for the play-offs.