Former Sheffield United defender Phil Jagielka helped Stoke City consign the Championship leaders to a second successive loss.
The home side took an early lead when Ben Wilmot converted from a pass from 40-year-old Jagielka but Rhian Brewster levelled for the away side with a crisp finish.
Jagielka then headed home from a corner in time added on at the end of the first half for his first goal since April 2019.
The Potters, who had been winless in three, wrapped up the win in the final minute when Liam Delap tapped in from close range from Tyrese Campbell's centre.