Birmingham twice fought back against high-flying Middlesbrough before Marlon King's well-taken finish claimed only a second home win in seven attempts at St Andrew's.
Boro captain Grant Leadbitter headed his first npower Championship goal of the season to put the visitors ahead before King, who had earlier hit the outside of a post, picked himself up to draw level from the penalty spot on the stroke of half-time, an equaliser City scarcely deserved.
Scott McDonald capitalised on some shambolic defending from Pablo Ibanez to nudge Boro back in front just after the hour mark but, again, the home side drew level courtesy of substitute Wade Elliott's lob, which really should have been kept out by Jason Steele.
But there was nothing fortunate about King's matchwinning second, a sublime low finish across Steele in the 81st minute to claim three much-needed points for Lee Clark's side, ending a four-match winless run.
Lowly Birmingham's joy came on a night in which frustrated home fans had earlier unfurled a banner which read 'Clark out, Carson out', referring to Hong Kong-based owner Carson Yeung and the club's ongoing takeover talk.
Middlesbrough went into the clash knowing victory would take them joint top of the Championship and they will have felt hard done by as they slipped to a third defeat in four games.
Boro certainly went into the clash as the more impressive side this season but history was not on their side having won just one of their previous 15 visits to St Andrew's.
Blues were first to threaten courtesy of towering Serbian striker Nikola Zigic but his header from the free-kick of loanee Rob Hall, making his full debut, went narrowly wide.
The visitors' attractive passing style was certainly easy on the eye and it was they who broke the deadlock after 14 minutes.
The ball was recycled to Andy Halliday out on the left and, with unorthodox Blues right midfielder Jonathan Spector out of position, Leadbitter, back from suspension, nodded home from six yards.
Lukas Jutkiewicz should have made it 2-0 after 21 minutes but his header from Justin Hoyte's cross flew off target.
Birmingham came within inches of a leveller soon after when Steele's fingertips nudged King's low effort on to the outside of a post following a flowing counter.
Boro were playing the ball around well, with Leadbitter and Nicky Bailey pulling the strings, but Birmingham were certainly struggling to find any kind of rhythm.
Jack Butland twice saved from Emmanuel Ledesma before, out of nowhere and with half-time approaching, the hosts drew level.
King turned Andre Bikey, who tripped the striker in the penalty area, and King himself stepped up to convert.
England prodigy Butland twice came to Birmingham's rescue at the start of the second half, saving close range from Josh McEachran's cross and then clawing away McDonald's attempted lob.
But McDonald was to beat Butland just after the hour mark, capitalising on defensive hesitancy from Ibanez before firing home in a goalmouth scramble.
Boro keeper Steele saved well from Spector but was soon at fault for Birmingham's equaliser as he failed to keep out Elliott's 25-yard lob.
And it was left for King to have the final say, finishing superbly after Boro had given the ball away to sub Peter Lovenkrands in the middle of the park.