The Potters had looked set for a 3-1 victory in normal time at St Andrew's until Blues substitute Peter Lovenkrands scored twice in a stunning finale to send the game to extra time.
Kenwyne Jones again put Stoke ahead just four minutes into the additional period before, amazingly, the Sky Bet Championship hosts managed to level once more late on courtesy of Olly Lee to make it 4-4 and round off an incredibly dramatic 120 minutes.
Stoke eventually progressed 4-2 in the subsequent penalty shoot-out to book their place in the last eight, much to the relief of Hughes, who celebrates his 50th birthday on Friday.
"Credit to Birmingham, I thought they were magnificent," Hughes said. "They kept on going and they were a credit to their manager and their club.
"With them being down to 10 men we got into a position where we are 3-1 to the good with 20 minutes to go, we should see the game out quite comfortably.
"But for whatever reason - maybe we lost a little bit of focus and ally that to the attitude and endeavour of Birmingham - we allowed them back into the game.
"I'm sure the neutral thought it was a fantastic game, from my point of view it was awful.
"You think the game's done and dusted and it should be, we need to be able to see out games in those circumstances quite comfortably. We showed an unbelievable amount of naivety in terms of what was required to put the match to bed."
For the big stories and the banter follow us on Twitter: @tribalfootball