Lee Johnson’s first return to Oakwell provided mixed emotions as his Bristol City side were pegged back thanks to sub Adam Hammill’s 90th-minute leveller.
Johnson, who left the Reds for Ashton Gate in February, watched on as Hammill lashed home from an acute angle just as the game entered stoppage-time.
Sam Winnall was earlier a rogue for the Reds, missing a penalty opportunity seconds before the break.
Johnson was afforded a generally warm reception from the Oakwell faithful just before kick-off, but after that a terrific and dramatic first half followed.
After veteran strike Aaron Wilbraham had gone close for the visitors, the Reds struck the opening blow in the 21st minute.
And it was Marley Watkins who struck, glancing home a header as he leapt brilliantly to meet Andy Yiadom’s cross.
Debutant teenager Josh Kay fired a 25-yard strike inches over for the hosts, before Sam Winnall fluffed a gilt-edged opportunity to double his side’s lead in first-half stoppage-time.
After picking himself up off the deck after being fouled by ex-Red Scott Golbourne, Winnall enabled Frank Fielding to comfortably save his disappointing spot-kick.
Yiadom was first to threaten in the second period, seeing an angled effort drift wide following a neat lay-off from Kent.
The visitors responded with another ex-Red - Korey Smith - firing over the top from 20 yards.
The scores were level in the 58th minute.
Adam Jackson inexplicably handled a routine cross from Golbourne, leaving Lee Tomlin to fire home clinically from the penalty spot this time.
Credit to the Reds, they came battling back and Adam Armstrong fired a superb 63rd-minute effort against the crossbar.
At the other end, Adam Davies was brilliantly agile in tipping Wilbraham’s header onto the post.
The visitors did get their second goal with 14 minutes to go.
Hot-shot Tammy Abraham struck, this time poking home from close range after meeting a smart Tomlin cross from the right.
However, that wasn’t enough for Johnson’s men thanks to Hammill’s late heroics.
Barnsley (4-4-2): Davies; Bree, MacDonald, Jackson, Yiadom; Kent, Morsy, Kay (Williams, 88), Watkins (Hammill, 75); Winnall, Armstrong.Subs not used: Townsend, Kpekawa, Evans, Lee, Bradshaw.
Bristol City (4-3-1-2): Fielding; Matthews (Brownhill, 80), Flint, Magnusson, Golbourne (Bryan, 66); Reid (Moore, 66), O’Neil, Smith; Tomlin; Wilbraham, Abraham.Subs not used: O’Donnell, Engvall, Paterson, Pack.
Referee: Geoff Eltringham (County Durham).