Thordor Gudjonsson gave Stoke the lead after half an hour but ten minutes later the Reds equalised through trialist Sosthene Yao.
Yao was at West Ham as a trainee.
Robbie Williams scored the winner with 20 minutes remaining on the clock for a vital win despite fielding a very inexperienced side.
Barnsley Line-up: Flinders, Harban, Laight, Atkinson, Williams, Tonge, Heslop, Batley, Yao, Joynes, Jarman.
Subs: Holt, Naylor, Jordan, Farmery, Beevor.