Birmingham scored two late goals in three minutes to earn their first home win in 13 games as they came from behind to beat QPR 2-1 at St Andrew's.
Alen Halilovic scored a cracker for his first goal for the club after Kristian Pedersen equalised to cancel out Charlie Austin's opener, securing Birmingham's first victory on home soil since they beat Huddersfield 2-1 on October 28 – 122 days ago.
A second win in three put Blues five points clear of the Sky Bet Championship relegation zone.
On the 10th anniversary of Birmingham winning the League Cup, the late goals – in the 82nd and 85th minutes – came just as it looked like it was going to be a familiar story for the hosts.
Austin's strike came against the run of play after the hosts made the better start and created several chances.
Gary Gardner's well-struck angled volley from the edge of the box was acrobatically tipped around a post by goalkeeper Seny Dieng and Scott Hogan missed a great opportunity on the half hour.
Ivan Sanchez crossed from the right and Hogan rose unchallenged only to get his angles wrong and glance horribly wide.
QPR's first sight of goal did not come until the 35th minute when Austin's well-struck volley flew several yards wide after Todd Kane's flick.
Blues returned to the attack and Jeremie Bela's angled shot was tipped behind by Dieng but looked as if it might have been going wide anyway.
Aitor Karanka's side were made to pay for their wastefulness when QPR took the lead completely against the run of play in the 44th minute.
Austin stole in unmarked between Harlee Dean and Maxime Colin at the far post to volley home Kane's right-wing cross from four yards out.
It was Austin's third goal in his last two visits to the ground after he came off the bench to score twice in a 3-2 win for Albion in December 2019.
Another chance for Birmingham went begging soon after the restart when Bela completely missed an attempt at a header from Sanchez's corner.
QPR immediately raced up the other end of the pitch only for Stefan Johansen to balloon the ball high over the bar from Chris Willock's cross.
Karanka made a triple substitution in the 63rd minute – Marc Roberts, Halilovic and Jonathan Leko replacing Jake Clarke-Salter, Gardner and Bela – and it turned out to be an inspired switch.
Birmingham had a let-off first however as Johansen robbed Roberts and fed Macauley Bonne, who dallied too long when he should have shot first time.
Bonne then flashed a rising drive just wide of the angle as Rangers pressed for a second goal.
Pedersen equalised when he glanced home Roberts' cross from six yards after the latter's throw-in was cleared.
Then Halilovic curled home a tremendous 20-yard shot into the bottom corner for the winner.