League Two Rochdale gave a tireless performance to eventually overcome their Championship opponents after a dramatic penalty shoot-out at Spotland.
After a nervous start in which they fell behind Keith Hill's side were much the better virtually throughout the game and were denied an outright win by Richard Cresswell's last-gasp equaliser.
The Rochdale defence had switched off after just four minutes allowing defender Ryan Shawcross a free header to give his side the lead.
Other than a shot on the turn by Jon Parkin that was well-saved Stoke offered little or nothing.
Rochdale equalised in the 85th minute when man-of-the-match Dave Perkins played an exquisite 1-2 with Glenn Murray. They might have scored just a few moments before when the game's best move saw Adam Rundle strike an upright before producing a driven finish.
In injury time Rochdale must have throught they had won when Rory Prendergast converted a Ben Muirhead cross but with literally seconds remaining substitute Cresswell saw his shot canon off a Dale challenge and into the net for an undeserved equaliser.
Keeper James Spencer made one excellent penalty save and after Stoke defender Carl Dickinson had blazed his attempt over, Rochdale skipper Gary Jones sealed the win with a very calm spot kick.