Birmingham twice fought back against high-flying Middlesbrough before Marlon King's well-taken finish secured a 3-2 win, only their second home triumph 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. King fired in the winner in the 81st minute to claim three much-needed points for Lee Clark's side, ending a four-match winless run.
Middlesbrough went into the clash knowing victory would take them joint top of the Championship but they slipped to a third defeat in four games. Boro went into the clash with history against them 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, but it was the visitors who broke the deadlock after 14 minutes.
The ball was recycled to Andy Halliday out on the left and, with Jonathan Spector out of position, Leadbitter nodded home from six yards. Birmingham came within inches of a leveller soon after when Boro keeper Jason Steele's fingertips nudged King's low effort on to the outside of a post following a flowing counter.
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.