Craig Bellamy and Mark Hudson struck to send Cardiff City to the top of the Championship with a historic fifth successive home league win.
Peter Whittingham and Mark Hudson combined to give Bellamy the chance to open in the 39th minute.
Leroy Lita punished Hudson's foul to level, hitting home from 10 yards after the free kick.
Home skipper Hudson made amends amid the goalmouth scramble created by Whittingham's well-struck corner.
The Bluebirds have now not lost in 10 league games at the Cardiff City Stadium since Hull's triumphant visit on 13 March, 2012.
And victory on home soil left the Bluebirds celebrating their best home league run at the start of a season in 66 years.
But defeat on a wet night in the Welsh capital means Birmingham continue to search for a second away win of the season.
Bellamy threatened early on, but his effort cleared the crossbar and Craig Noone saw a similar effort miss the mark.
The visitors underlined their threat when Keith Fahey's lofted ball gave Lita a chance to head home, but David Marshall was equal to the challenge.
Lita saw another chance rise harmlessly over the bar from 12 yards as Birmingham's confidence increased.
Such was the visitors' hold on the contest as the opening period went on that Cardiff were unable to earn a clear sight of goal.
Hudson sent an effort wide before of Blues goalkeeper Jack Butland comfortably dealt with Aron Gunnarsson's shot.
But the hosts took the lead when Whittingham found Hudson, who gave Bellamy the chance to open the scoring from 12 yards.
Bellamy went close with a long-range free-kick to leave his side 1-0 ahead at the break.
Lita, on loan from Swansea City, equalised after 54 minutes, putting the final touch to Wade Elliot's cross from close range.
However, Birmingham's best efforts to keep the hosts contained failed as Hudson's poaching instincts came to the fore from Whittingham's cross.
Joe Mason brought the best out of Butland, who executed a wonderful late save from the striker.
And the visiting goalkeeper rescued Birmingham again when Bellamy threatened before his 79th-minute departure.
Birmingham boss Lee Clark told BBC WM:
"We deserved something from this football match, without a shadow of a doubt.
"And anyone who says anything different, I'll tell them the truth.
"We deserved at least a point. We passed it round well and got a deserved equaliser, then them getting back in the game so quick was a blow. We should have dealt with it. We should have come and punched it.
"The performances for the past couple of games have been encouraging. Now we've just got to push on."
The offside flag is raised against Marlon King. David Marshall takes the indirect free kick.
Foul by Paul Robinson on Don Cowie, free kick awarded. Peter Whittingham takes the free kick.
Christopher Burke crosses the ball, save by Jack Butland.
Kevin McNaughton gives away a free kick for an unfair challenge on Wade Elliott. Paul Robinson delivers the ball from the free kick right-footed from left channel, Heidar Helguson manages to make a clearance.
Free kick awarded for an unfair challenge on Peter Whittingham by Steven Caldwell. Free kick taken by Peter Whittingham.
Substitution Bo-Kyung Kim replaces Craig Noone.
The official flags Mark Hudson offside. Jack Butland takes the free kick.
Marlon King takes a shot. Save by David Marshall.
Foul by Keith Fahey on Heidar Helguson, free kick awarded. David Marshall takes the indirect free kick.
Heidar Helguson challenges Christopher Burke unfairly and gives away a free kick. Free kick crossed right-footed by Wade Elliott from right wing, clearance made by Andrew Taylor.
Substitution Don Cowie joins the action as a substitute, replacing Craig Bellamy.
Craig Bellamy takes a shot. Save by Jack Butland. Inswinging corner taken left-footed by Peter Whittingham from the right by-line, save made by Jack Butland.
The ball is swung over by Aron Gunnarsson.
Free kick awarded for a foul by Christopher Burke on Craig Noone. Direct free kick taken by Andrew Taylor.
Substitution Peter Lovenkrands goes off and Nathan Redmond comes on.
Unfair challenge on Andrew Taylor by Wade Elliott results in a free kick. David Marshall restarts play with the free kick.
The referee blows for offside. Free kick taken by Jack Butland.
Free kick awarded for a foul by Steven Caldwell on Mark Hudson. Direct free kick taken by Aron Gunnarsson.
Booking Craig Bellamy goes into the referee's book.
Foul by Craig Bellamy on James Hurst, free kick awarded. Jack Butland takes the indirect free kick.
Corner taken by Peter Whittingham from the right by-line, Jack Butland makes a save. Outswinging corner taken from the left by-line by Craig Noone,
Joe Mason takes a shot. Save made by David Marshall.
Substitution (Birmingham) makes a substitution, with Marlon King coming on for Leroy Lita.
The offside flag is raised against Leroy Lita. Free kick taken by David Marshall.
Keith Fahey takes a shot. Blocked by Mark Hudson.
Free kick awarded for an unfair challenge on Jonathan Spector by Heidar Helguson. Free kick crossed by Wade Elliott, Mark Hudson makes a clearance. Keith Fahey takes a shot. Blocked by Andrew Taylor.
Joe Mason takes a shot. Blocked by Steven Caldwell.
Matthew Connolly challenges Jonathan Spector unfairly and gives away a free kick. Keith Fahey crosses the ball from the free kick right-footed from right channel, clearance made by Peter Whittingham.
Joe Mason produces a left-footed shot from inside the area that goes over the bar.
Foul by Peter Lovenkrands on Andrew Taylor, free kick awarded. Peter Whittingham takes the free kick.
Peter Whittingham provided the assist for the goal.
56:12 Goal scored
Goal! - Mark Hudson - Cardiff 2 - 1 Birmingham Mark Hudson finds the net with a goal from close range to the bottom left corner of the goal. Cardiff 2-1 Birmingham.
Booking Curtis Davies booked for dissent.
Inswinging corner taken by Peter Whittingham from the right by-line,
The assist for the goal came from Wade Elliott.
53:01 Goal scored
Goal! - Leroy Lita - Cardiff 1 - 1 Birmingham Leroy Lita scores a goal from close in to the bottom left corner of the goal. Cardiff 1-1 Birmingham.
Wade Elliott produces a cross,
Booking Mark Hudson goes into the referee's book for unsporting behaviour.
Free kick awarded for a foul by Mark Hudson on Leroy Lita.
Substitution Will Packwood leaves the field to be replaced by James Hurst.
The ball is crossed by Craig Noone, Heidar Helguson takes a shot from just inside the penalty box which clears the bar.
Andrew Taylor challenges Will Packwood unfairly and gives away a free kick. Direct free kick taken by Will Packwood.
The second half has started.
45:00 +1:20 Half time
Half Time The match has reached half-time.
Foul by Paul Robinson on Craig Bellamy, free kick awarded. Strike comes in from Craig Bellamy from the free kick.
The ball is sent over by Joe Mason, Jack Butland makes a save.
Foul by Wade Elliott on Craig Noone, free kick awarded. Peter Whittingham takes the free kick.
Unfair challenge on Leroy Lita by Mark Hudson results in a free kick. Direct free kick taken by Paul Robinson.
The assist for the goal came from Mark Hudson.
38:09 Goal scored
Goal! - Craig Bellamy - Cardiff 1 - 0 Birmingham Craig Bellamy gets on the score sheet with a goal from inside the box to the bottom right corner of the goal. Cardiff 1-0 Birmingham.
Free kick awarded for an unfair challenge on Joe Mason by Paul Robinson. Free kick crossed by Peter Whittingham, Leroy Lita makes a clearance.
Effort from the edge of the area by Christopher Burke goes wide of the left-hand post.
Aron Gunnarsson has an effort at goal from 12 yards. Jack Butland makes a comfortable save.
Craig Noone produces a cross, save made by Jack Butland.
Mark Hudson has an effort at goal from just outside the area which goes wide of the left-hand post.
The offside flag is raised against Craig Bellamy. Jack Butland takes the indirect free kick.
Free kick awarded for an unfair challenge on Wade Elliott by Joe Mason. Paul Robinson restarts play with the free kick.
Wade Elliott challenges Craig Noone unfairly and gives away a free kick. Free kick crossed left-footed by Peter Whittingham, clearance made by Peter Lovenkrands.
The assistant referee signals for offside against Craig Bellamy. Indirect free kick taken by Jack Butland.
Effort on goal by Leroy Lita from deep inside the area goes harmlessly over the bar.
The ball is delivered by Peter Whittingham, clearance by Wade Elliott. Inswinging corner taken from the right by-line by Aron Gunnarsson.
Keith Fahey fouled by Aron Gunnarsson, the ref awards a free kick. A cross is delivered by Keith Fahey, Leroy Lita takes a shot. David Marshall makes a save. Inswinging corner taken from the left by-line by Wade Elliott.
Foul by Wade Elliott on Kevin McNaughton, free kick awarded. David Marshall restarts play with the free kick.
Christopher Burke fouled by Mark Hudson, the ref awards a free kick. Steven Caldwell takes the direct free kick.
The referee blows for offside against Heidar Helguson. Steven Caldwell restarts play with the free kick.
Shot on goal by Craig Noone from just inside the area goes over the target.
Joe Mason is ruled offside. Free kick taken by Jack Butland.
Unfair challenge on Heidar Helguson by Keith Fahey results in a free kick. Free kick taken by Kevin McNaughton.
Craig Bellamy takes a shot from just outside the penalty area clears the crossbar.
Free kick awarded for a foul by Wade Elliott on Peter Whittingham. Free kick taken by David Marshall.
Jonathan Spector produces a right-footed shot from just outside the box that goes wide right of the target.
The referee blows for offside. Indirect free kick taken by Jack Butland.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.