Danny Haynes returned to haunt his old club as Barnsley secured just their second win in 11 matches in a dramatic six-goal thriller.
Haynes, who left Ashton Gate in January, scored the hosts' second goal as they fought back from a goal down to post a solid 4-2 win.
Marvin Elliott's strike after just six minutes handed the Robins the advantage but he then conceded the penalty which Andy Gray converted to trigger a stunning comeback for Barnsley.
Haynes put them ahead before Jacob Butterfield scored the goal of the match to put the Tykes in control at the break, with Paul McShane adding the fourth and Nicky Maynard grabbing a late consolation from the spot.
Mark Robins' side carved out the first opening when Hugo Colace rifled in a 20-yard drive which was well blocked by Lewin Nyatanga.
But it was City who opened the scoring when Elliott controlled Jordan Spence's pass and stroked in a low effort from inside the box.
The Tykes composed themselves after the early setback and created another chance of their own when Marlon Harewood steered Matthew Hill's cross just wide of the upright.
Jamal Campbell-Ryce then fired a long-range shot narrowly over as Keith Millen's men looked to apply the pressure.
City were forced to make a change when Colace picked up an injury in a challenge with Campbell-Ryce, with Jacob Mellis coming on to replace him.
And in the 32nd minute Elliott completed his turnaround from hero to villain as he handled in the box to allow Gray to equalise from the spot.
With the home side in the ascendancy, they attacked once more and after Harewood had been brought down on the edge of the box, Kieran Trippier curled in a testing free-kick which David James tipped past the post.
Maynard eluded the attentions of the Barnsley defence at the other end but was thwarted by the alert Luke Steele.
And Haynes seized his moment to smash one past his former employers when he followed up Gray's lacklustre effort to drill it home just before the break.
There was more to come from Barnsley and Butterfield arrowed home a wonderful strike from the left corner of the box in first-half stoppage time.
Buoyed by the impressive turnaround, the home side were immediately on the front after the interval, with Gray curling a shot wide after Haynes had been denied by the legs of James.
Steele went full-stretch to keep out Maynard's shot on the turn as City tried to find a way back into the match.
But the points were put beyond their reach when Hull loanee McShane headed home Butterfield's cross from close range, making Maynard's late penalty, awarded following Stephen Foster's foul on Albert Adomah, a mere consolation.
Copyright (c) PA Sport 2009, All Rights Reserved.