Nathan Tyson hit an 84th-minute winner to earn Nigel Clough's Derby a dramatic victory and increase Birmingham's troubles near the bottom of the table.
Conor Sammon had given the Rams the lead with a header before Marlon King equalised with a penalty after Robert Hall was fouled by Richard Keogh.
Sammon put Derby ahead for a second time before Peter Lovenkrands thought he had earned the Blues a point.
But Tyson's close-range finish sent the visitors to defeat.
Birmingham's defensive troubles
Birmingham have conceded three or more goals in five of their 18 league games this season
Lee Clark's strugglers have won just two of their last 10 games, but they will feel they should have left Pride Park with a point.
Former Wigan striker Sammon opened the scoring in the 32nd minute after Michael Jacobs had struck the woodwork.
King levelled with a 73rd-minute penalty after Keogh's lunge on Hall, playing his first game since signing on loan from West Ham.
That was the first of four goals in 11 minutes - Sammon firing Derby ahead for the second time from 10 yards.
Former Newcastle striker Lovenkrands equalised for Birmingham eight minutes from time.
But with six minutes remaining, Tyson had the final say to lift Derby into 12th.
Live Text Commentary
Full Time The final whistle goes and the game is over.90:00 +3:55 Substitution
Substitution Jeff Hendrick replaces Will Hughes.90:00 +1:43
Effort from just outside the area by Will Hughes goes over the bar.90:00 +1:08
Paul Coutts decides to take the corner short.88:52 Substitution
Substitution Michael Jacobs leaves the field to be replaced by Mark O'Brien.88:10
Craig Bryson produces a right-footed shot from outside the penalty box and misses right.87:00
Jonathan Spector challenges Nathan Tyson unfairly and gives away a free kick. Michael Jacobs restarts play with the free kick.83:44
Assist by Michael Jacobs.83:44 Goal scored
Goal! - Nathan Tyson - Derby 3 - 2 Birmingham Nathan Tyson finds the back of the net with a goal from close in to the bottom right corner of the goal. Derby 3-2 Birmingham.83:27
Marlon King takes a shot. Jake Buxton gets a block in.81:23
Assist on the goal came from Jonathan Spector.81:23 Goal scored
Goal! - Peter Lovenkrands - Derby 2 - 2 Birmingham Peter Lovenkrands grabs a headed goal from close range. Derby 2-2 Birmingham.79:29
Jake Buxton provided the assist for the goal.79:29 Goal scored
Goal! - Conor Sammon - Derby 2 - 1 Birmingham Goal scored by Conor Sammon from inside the box to the bottom right corner of the goal. Derby 2-1 Birmingham.78:40
Corner taken by Paul Coutts from the right by-line, clearance by Steven Caldwell.77:15
Marlon King takes a shot. Blocked by Richard Keogh.75:25
Foul by Paul Coutts on Nikola Zigic, free kick awarded. Curtis Davies takes the direct free kick.72:49
Assist on the goal came from Robert Hall.72:49 Goal scored
Goal! - Marlon King - Derby 1 - 1 Birmingham Placed penalty scored by Marlon King. Derby 1-1 Birmingham.72:00
Foul by Richard Keogh on Robert Hall, Penalty awarded.
Substitution Theo Robinson goes off and Nathan Tyson comes on.69:37
Free kick awarded for a foul by Will Hughes on Robert Hall. Peter Lovenkrands produces a strike on goal direct from the free kick.68:56
Foul by Theo Robinson on Steven Caldwell, free kick awarded. Jack Butland restarts play with the free kick.68:21
The assistant referee signals for offside against Theo Robinson. Indirect free kick taken by Hayden Mullins.67:47 Substitution
Substitution Wade Elliott goes off and Peter Lovenkrands comes on.67:33
Robert Hall has an effort at goal from outside the penalty box which goes wide left of the goal.66:30
Will Hughes takes a shot. Save made by Jack Butland.64:08
Jonathan Spector concedes a free kick for a foul on Michael Jacobs. Gareth Roberts takes the direct free kick.62:27
Shot from deep inside the area by Theo Robinson goes over the bar.59:01
Direct free kick taken by Gareth Roberts.59:01 Substitution
Substitution Robert Hall joins the action as a substitute, replacing Christopher Burke.59:01 Booking
Booking Jonathan Spector receives a yellow card for unsporting behaviour.58:39
Michael Jacobs fouled by Jonathan Spector, the ref awards a free kick.58:10
Conor Sammon takes a shot. Save made by Jack Butland.57:04
Ravel Morrison gives away a free kick for an unfair challenge on Craig Bryson. Adam Legzdins takes the direct free kick.48:34
Marlon King takes a shot. Blocked by Richard Keogh.48:21
Nikola Zigic takes a shot. Richard Keogh gets a block in.47:01
Theo Robinson produces a right-footed shot from just outside the penalty area that goes harmlessly over the target.45:01
The referee gets the second half underway.45:00 +1:17 Half time
Half Time The half-time whistle blows.43:08 Booking
Booking Michael Jacobs receives a caution.41:49
Free kick awarded for an unfair challenge on Jonathan Spector by Michael Jacobs. Jack Butland takes the direct free kick.39:38
Outswinging corner taken right-footed by Michael Jacobs played to the near post, Header from close range by Theo Robinson misses to the right of the target.39:08
Wade Elliott takes a shot. Blocked by John Brayford.37:22
Theo Robinson takes a shot.36:29
Wade Elliott has an effort at goal from outside the area missing to the wide right of the target.35:52
Craig Bryson takes a shot from just inside the penalty box which clears the crossbar.34:51
Headed effort from inside the penalty area by Nikola Zigic misses to the right of the target.33:08
Paul Coutts takes the inswinging corner, Jack Butland makes a save.32:35
Theo Robinson takes a shot. Blocked by Curtis Davies.31:03
Assist on the goal came from Michael Jacobs.31:03 Goal scored
Goal! - Conor Sammon - Derby 1 - 0 Birmingham Conor Sammon finds the net with a headed goal from inside the area. Derby 1-0 Birmingham.31:00
Michael Jacobs takes a shot. Save made by Jack Butland.29:45
Craig Bryson takes a shot. Save by Jack Butland.29:01
Paul Robinson concedes a free kick for a foul on Paul Coutts. Free kick taken by Paul Coutts.24:08
Wade Elliott produces a left-footed shot from deep inside the penalty area which goes wide of the left-hand post.22:50
Corner taken right-footed by Paul Coutts from the right by-line, Paul Robinson manages to make a clearance.22:12
Outswinging corner taken by Paul Coutts from the right by-line, clearance made by Hayden Mullins.20:55
Inswinging corner taken by Paul Coutts from the left by-line played to the near post, Curtis Davies manages to make a clearance.19:34
Theo Robinson takes a shot. Blocked by Steven Caldwell.18:13
Nikola Zigic gives away a free kick for an unfair challenge on Richard Keogh. Jake Buxton takes the free kick.17:42
Theo Robinson produces a left-footed shot from just outside the area that goes wide left of the goal.15:52
Free kick awarded for a foul by Nikola Zigic on Will Hughes. Michael Jacobs delivers the ball from the free kick right-footed from right channel.15:08
The official flags Marlon King offside. Adam Legzdins restarts play with the free kick.10:01
Ravel Morrison fouled by Craig Bryson, the ref awards a free kick. Direct free kick taken by Jack Butland.8:32
Conor Sammon takes a shot. Curtis Davies gets a block in.7:17
The ball is delivered by John Brayford.6:16
Short corner taken by Paul Coutts from the right by-line.4:36
Hayden Mullins produces a right-footed shot from just outside the penalty box that misses to the left of the goal.2:36
Craig Bryson challenges Hayden Mullins unfairly and gives away a free kick. Free kick taken by Jack Butland.1:11
Theo Robinson challenges Curtis Davies unfairly and gives away a free kick. Jack Butland takes the direct free kick.0:00
The game gets underway.
Live data and text provided by our data suppliers