Stoke progressed into the quarter-finals of the Capital One Cup as they saw off brave 10-man Birmingham on penalties following an incredible 4-4 thriller at St Andrew's.
It is only the third time the Potters have made the last eight of the competition since winning the League Cup back in 1972, the sole major honour in the club's 150-year history.
Stoke had looked set for 3-1 victory in normal time until Blues substitute Peter Lovenkrands scored twice late on amid a stunning finale to send the majority of the 13,436 present into raptures.
It was a plucky response from the hosts having controversially seen Wade Elliott dismissed amid a mass melee on the stroke of half-time for an apparent elbow on Oussama Assaidi, who was accused of making the most of the contact.
It was the Moroccan winger, on loan from Liverpool, who put the visitors on their way as he drilled into the top corner from 30 yards before Tom Adeyemi levelled for Blues and ensured the cup tie was a real contest heading towards the interval.
The Potters needed no invitation to make their numerical advantage count in the second half as Peter Crouch headed a second and Marko Arnautovic added a well-taken third.
But, out of nowhere, 2011 winners Birmingham forced extra-time only to be undone by Stoke substitute Kenwyne Jones just four minutes into matters.
Yet, once again, amazingly, the home side managed to level once more late on courtesy of Olly Lee to send the game to penalties.
Steven N'Zonzi duly netted the winning spot-kick in a 4-2 triumph as the Staffordshire outfit, struggling and winless in the Barclays Premier League since late August, finally prevailed.
And it would have been a mightily relieved Stoke manager Mark Hughes who celebrated the full-time whistle three days ahead of his 50th birthday.
Hughes made five changes from Saturday's narrow 3-2 defeat at Manchester United and it was two of those who combined for the visitors' stunning opener.
Arnautovic, so impressive at Old Trafford, fed Marc Muniesa down the left and he backheeled into the path of Assaidi, who let fly with a long-range screamer into the top corner despite the best efforts of Colin Doyle.
Birmingham had struggled to get a foothold on proceedings but they equalised in fine style just before the half-hour mark courtesy of another well-worked goal.
Nikola Zigic headed on Mitch Hancox's long ball, Lee Novak surged forward and flicked into the path of the onrushing Adeyemi, who had time and space to convert coolly past Thomas Sorensen.
The tie had become a finely-balanced affair leading up to half-time but that soon changed when Elliott controversially saw red for an adjudged raised elbow on Assaidi amid a large scuffle by the corner flag.
And, having threatened a couple of times, it was not long before Stoke made their numerical advantage count in the second period as Crouch flicked home Muniesa's cross from the right.
Arnautovic added a sweet third in the 70th minute having received N'Zonzi's pass before Crouch smashed an overhead kick against the woodwork.
Lovenkrands netted from close range in the 85th minute to provide Birmingham with a lifeline, which they duly grabbed courtesy once more of the Dane as he poked home after Sorensen could only parry Demarai Gray's effort amid five minutes of injury time.
Jones thought he had had the final say as he received Stephen Ireland's throughball to round Doyle and convert, only for Lee to force penalties with a finish from distance.
And it was Stoke who triumphed to book their place in Wednesday's quarter-final draw.