Relegation-threatened Birmingham gained a valuable three points against 10-man Burnley after top scorer Marlon King struck in the 90th minute.
Blues defender Curtis Davies had opened the scoring after he got on the end of a corner from loanee Rob Hall.
Ross Wallace then levelled from the penalty spot before Dean Marney was dismissed for a foul on Paul Robinson.
The match seemed to be on course for a draw until King followed up on a header from Nikola Zigic at the death.
Cash-strapped Birmingham came into the match just five points off the drop zone and with the prospect of being forced to sell their leading players in the January transfer window.
Centre-back Davies - who excelled throughout at Turf Moor - is one of the leading candidates to be sold as the club looks to ease its financial problems and he was in the right place to head in from a set piece.
Burnley started with real hopes of closing the gap to the play-off places but struggled to get into the match in a poor first-half display.
Manager Sean Dyche's side were much improved after the break and levelled through Wallace's spot kick minutes after Danny Ings had rattled the Birmingham crossbar.
The momentum remained with the Clarets until Marney was sent off for a challenge on Robinson in the middle of the pitch.
Birmingham slowly began to crank up the pressure and, after giant striker Zigic headed against the woodwork, 13-goal leading scorer King was on hand to secure only a second win in nine league games.
Burnley manager Sean Dyche:
"Some of the football was excellent but you are having to earn wins not just by beating 11, we've having to go beyond that. The officials should be there to manage the game and not make decisions that change it radically.
"Apparently Marney's red card was for excessive force so I think you've got to tackle softly now, I don't think you're allowed to tackle the ball. You cannot take a great tackle out of the game because it will kill football.
"We didn't deserve to lose the game. In the first half we were just off it slightly but then second half I thought we were terrific."
Birmingham manager Lee Clark on the club's financial situation:
"We need to do something in terms of players outgoing to keep us going, for a couple of days it will be a bit tough, but come Thursday night I will know what I am doing. The toughest thing for us at the moment is that I cannot go after the targets that I want.
"I can't make calls to players and their agents at this moment in time because I don't know what I have got to work with. This has been a massive learning curve for me, as all the coaching courses I have been on could never teach me how to handle the situation.
"But I am enjoying it, I am at a massive football club and we want to get it back to where it belongs. I am proud to be the manager here."