Daryl Murphy's late strike maintained Sunderland's unbeaten record in 2007 and dented Stoke's play-off hopes.
The Black Cats went behind after 22 minutes when keeper Darren Ward somehow allowed Darel Russell's weak shot in.
The hosts were level a minute later through Dean Whitehead's 25-yard effort but Carl Hoefken's sweet half-volley put Stoke ahead just before half-time.
Stoke were holding on comfortably in the second half until the 90th minute when Murphy volleyed in from 12 yards.
Sunderland boss Roy Keane:
"It was a great result because when you're 2-1 down with five minutes to go you'll take anything.
"I'm delighted with the players, they showed great desire to get a result.
"I can't praise them enough - they were different class. There were harsh words at half-time and in the second half the desire was what you would hope for."
Stoke boss Tony Pulis:
"I thought we defended well and had a lot of character and spirit.
"It's just desperately disappointing, but when I calm down I'll probably see it as a good result.
"We've got to win games and we came here to have a go. What we lack in a little bit of quality we make up with effort."
Sunderland: Ward, Simpson, Nosworthy, Evans (Wallace 46), Collins, Leadbitter, Whitehead, Yorke (Liam Miller 68), Hysen, John (Murphy 55), Connolly.
Subs Not Used: Fulop, Tommy Miller.
Booked: Simpson, Collins, Liam Miller.
Goals: Whitehead 24, Murphy 90.
Stoke: Simonsen, Hoefkens, Zakuani (Dickinson 82), Higginbotham, Griffin, Lawrence, Diao, Fortune, Russell, Sidibe (Eustace 86), Parkin (Fuller 61).
Subs Not Used: Hoult, Martin.
Booked: Lawrence, Hoefkens.
Goals: Russell 22, Hoefkens 45.
Att: 31,358.
Ref: M Jones (Mansfield).