Cardiff captain Sean Morrison secured a dramatic 3-2 victory over Bournemouth with a 90th-minute header.
The Bluebirds defender scored from close range at the death after Harry Wilson levelled the scores 10 minutes earlier.
It looked as if Neil Etheridge was going to deny his former side after he produced a stunning penalty save after Ivan Sanchez had given the Blues the lead with a solo strike, but Birmingham let their lead slip late on.
Cardiff manager Neil Harris was forced into a trio of changes following his side’s derby defeat at the weekend.
Joe Ralls, who was serving a one-match suspension after being sent off for two bookable offences during the defeat to Swansea, was replaced in midfield by Marlon Pack.
Robert Glatzel was tasked with providing the goals in the absence of the injured Kieffer Moore as Harris reverted back to a 4-2-3-1 formation that included Gavin Whyte in place of Mark Harris.
Etheridge started in goal for Birmingham against the club he left in the summer in a side containing four changes to the one beaten at home by Watford.
Harlee Dean returned to captain the side in place of Mikel San Jose and Jon Toral, Maxime Colin and Sanchez also came back into the starting XI.
Etheridge’s hopes of a clean sheet against his former side evaporated after 10 minutes following a defensive error from Jake Clarke-Salter.
The Birmingham left-back played a loose pass into the path of Wilson, who advanced towards goal.
The Liverpool loanee kept last defender Marc Roberts occupied before laying the ball off to Glatzel who side-footed home.
But Birmingham centre-back Roberts showed his class at the other end of the pitch to level the scores after 31 minutes.
Lukas Jutkiewicz held the ball up on the edge of the box after a Maikel Kieftenbeld free-kick before laying it off to Roberts, who feinted to shoot before drilling the ball low into the bottom corner to make it 1-1 at half-time.
Birmingham completed the comeback in the 57th minute thanks to a stunning solo goal from Sanchez.
The Spanish winger surged into the Cardiff half, weaving his way past Sheyi Ojo and Joe Bennett before unleashing a powerful left-footed strike that found the top corner.
Etheridge looked as if he had denied his former side after Clarke-Salter was adjudged to have handled in the box.
The goalkeeper went full stretch to tip Glatzel’s spot-kick around the post, but Cardiff still found time to snatch the equaliser.
Pack slid a perfectly weighted pass into the path of Wilson, who took one touch in the box before slotting the ball into the far corner.
And then Morrison ghosted in at the far post unmarked to head in Wilson’s corner and snatch all three points.