Birmingham head coach Lee Bowyer hailed a "massive result" after a last-gasp 1-0 win against promotion-chasing Swansea at St. Andrew's.
Substitute Scott Hogan was Birmingham's hero with a 91st-minute penalty after Ivan Sunjic went down after contact with sub Yan Dhanda.
It spared the blushes of team-mate Lukas Jutkiewicz, who missed from the spot earlier in the game.
Blues' second home win in a row under Bowyer moved them up to fifth from bottom and six points above the relegation zone, but third-bottom Rotherham have four games in hand on them.
"It was a massive result – to take anything from Swansea would have been good but to take all three points, it brings others closer and gives a gap on Rotherham," said Bowyer.
"The players are taking things on board and improving and learning individually and as a group.
"I liked everything about the performance – I think the work rate was very good and so was the press.
"Swansea are a top side – they are third in the table for a reason, with some very good players, and if you let them play and not got the press right, we'd have lost that game."
As for the winning penalty, Blues lost their previous taker as Jutkiewicz had been replaced by Sam Cosgrove – and Bowyer revealed Alen Halilovic, who was also subbed, had been designated the replacement taker.
"Jutkiewicz had been subbed so it was a case who wanted to be a hero, who was going to step up in the 91st minute?" said Bowyer.
"Hogan did that and put his penalty away, thankfully."
Jutkiewicz was denied in the 31st minute when his kick was blocked by goalkeeper Freddie Woodman after Connor Roberts fouled Jonathan Leko.
For the second spot-kick, Dhanda appeared to be off balance before he fell into Sunjic.
Hogan blasted the ball to Woodman's right, giving the goalkeeper no chance, for his seventh goal of the season.
Swansea suffered their third straight loss and are now nine points off second place with seven games left.
"For sure it was a poor performance," said head coach Steve Cooper.
"We fell well short of the levels we have hit before and aim to hit. I can't hide from the fact we weren't good enough.
"We were nowhere near good enough with the ball and we conceded two penalties.
"We defended OK but we are much better with the ball than we showed and that's the biggest reason why the result was what it was.
"We can't shy away from the fact we were below par. That's three straight losses, three games without a goal, but we don't need to start losing confidence or questioning things."
Regarding both penalties, Cooper said: "I haven't seen either penalty again but for the first it was a great save from Freddie.
"He did his homework and it's a brave thing to stand still but he made a good decision and a good save."
No Data Analysis info