Substitute Kieran Morgan struck with the last kick of the match to fire QPR up to sixth in the Sky Bet Championship after a 2-1 win over travel-sick Birmingham.
Blues thought they had secured a point when Patrick Roberts cancelled out Jimmy Dunne’s first-half header in the third minute of stoppage time.
But Rangers went straight up the other end and Morgan, who only came on with four minutes of normal time remaining, crashed in a dramatic last-gasp winner.
It secured a fourth win from their last five matches for the Hoops, while Birmingham have now lost seven matches on the road this season.
QPR, without Moroccan playmaker Ilias Chair through injury, were inches from taking an early lead when a Rhys Norrington-Davies curler from the edge of the box flew just wide.
Birmingham threatened through Demarai Gray, who was played in behind by Jay Stansfield, when he fizzed in a low cross which was just out of Marvin Ducksch’s reach.
The hosts looked shaky at the back, but were beginning to find their feet going forward and Amadou Mbengue’s cross was nodded back across goal by Koki Saito to Paul Smyth, whose downward header was straight at Blues keeper James Beadle.
The breakthrough came five minutes before half-time after Birmingham only half-cleared a corner.
Saito swung the ball back towards the far post where Rangers captain Dunne rose to powerfully head his second goal of the season past Beadle.
The Irish defender had scored a last-minute, 30-yard screamer to win the match the last time these sides met at Loftus Road, two seasons ago. This one was about 29 yards closer.
After the break, Beadle just managed to get a palm to a Norrington-Davies cross with Dunne lurking behind him again.
Moments later, with Birmingham making unnecessarily hard work of clearing their lines, Smyth stole the ball and crossed towards Mbengue, who could not convert at the far post.
Richard Kone should have doubled QPR’s lead on the hour from Nicolas Madsen’s cross, but volleyed over from six yards out.
Birmingham had barely registered an effort on goal all night, but as time ticked away and the homes side retreated, Gray fizzed in a low cross which zipped all the way to Roberts who finished at the far post.
But Rangers won a free-kick at the death and Jonathan Varane laid the ball back to Morgan who, from 20 yards out, pinged a superb drive past Beadle to snatch all three points.
The managers
QPR’s Julien Stephan:
“It was a lot of positive emotion just after a negative emotion.
“What a fantastic game we did, especially in the second half. I think it was a great game. Usually they are a team who shoots a lot and they shot three times, one on target.
“Then what character after a bad moment. All credit to the players. It was amazing. It’s probably why we do this job, to share that emotion.”
Birmingham’s Chris Davies:
“Obviously it’s a very painful defeat, as painful as it gets really, to get a goal in the last few minutes and then concede in the last seconds.
“In terms of the game itself we were too slow in the first half. The problem in some ways was the first goal, not the last.
“We gave ourselves too much to do. There had not been a lot of football on show from either team and we needed to get to half-time 0-0 and build from there.
“I don’t think we got in their box often. But staying in the game was a good sign and then we think can we get a point, which we nearly did.
“Last-minute winners are the worst feeling in football and we have to take our medicine.”

