It took just 10 minutes for Stoke to take the lead when Oussama Assaidi saw his 30-yard effort go in off the cross bar after the visitors dominated early proceedings.
But the Blues were level just before the half-hour mark when Tom Adeyemi finished off a Birmingham counter-attack by slotting home Lee Novak’s flick on.
And before Birmingham could begin searching for a goal to put them in front, they found themselves a man short after Wade Elliot was shown a straight red for allegedly raising an elbow on Assaidi.
And Stoke ensured they took full advantage of the extra man after the re-start, with Peter Crouch heading the visitors into the lead and then the in-form Marko Arnautovic doubled the Potters’ lead with a curling effort from Steven N’Zonzi’s lay-off.
With twenty minutes remaining Stoke looked to have sealed their place in the quarter-finals, but Blues boss Lee Clark mixed things up by sending on Peter Lovenkrands and Olly Lee in an attempt to spark a late surge.
And his substitutions proved to be the turning point as Lovenkrands pounced twice in the final five minutes to force the game into extra-time.
The Dane gave the Blues a glimmer of hope when he prodded home from close range in the 85th minute, and then took advantage of Stoke keeper Thomas Sorenson’s untimely spill to net the equaliser.
With the game in extra-time, many would have thought the disappointment of letting a two-goal cushion slip so late on would have Stoke deflated, but substitute Kenwyne Jones latched on to Stephen Ireland’s through ball and expertly rounded Blues keeper Colin Doyle to slide home Stoke’s fourth and put them back in control.
Birmingham had to rely on substitute Olly Lee to take the game to penalties. The youngster collected the ball on the edge of the Stoke penalty area before smashing in past Sorenson for his first Blues goal and giving his side a well deserved crack at the lottery of a penalty shoot out.
However, the resulting shoot-out proved to be a step too far for an impressive and resurgent Birmingham side, who missed their opening two penalties, while Stoke scored all of theirs to book their place in the round.
Stoke boss Mark Hughes admitted after the game that, despite his side eventually winning the game, he was disappointed that they needed a penalty shoot-out to settle it after letting a two goal cushion and 10-men advantage slip.
That’s now the second game in a row that Stoke have let winning positions get away from them and Hughes will need to put that right if he is to keep his side clear of danger in the Premier League this season.