Robins twice hit back to all but guarantee Championship survival
Aden Flint headed a 74th minute winner as Bristol City all but secured their Championship future with a thrilling 3-2 victory over Barnsley at Ashton Gate.
The result left Lee Johnson's men six points clear of third bottom Blackburn, with a vastly superior goal difference and only two matches left for both clubs.
City twice fell behind to goals from George Moncur, Tammy Abraham cancelling out the Barnsley man's opener, which had put the visitors in front at the break, and Jamie Paterson making it 2-2.
Paterson then turned provided as his corner set up Flint for the winner.
Barnsley had the better of the opening exchanges against a nervous looking home side.
Adam Armstrong had a fifth-minute shot saved by Fielding, while Moncur shot wide after a promising run.
A Joe Bryan cross was just beyond Taylor as City threatened for once.
But they were lucky after 20 minutes when an Alex Mowatt shot from inside the area was deflected on to a post by a defender.
City came closest to a first half goal after 35 minutes when Marlon Pack's low drive from the edge of the area brought a fine save from Adam Davies following a scramble in the Barnsley goalmouth.
But Barnsley took the lead in controversial circumstances two minutes later.
City left-back Bryan suffered a heavy fall in an aerial challenge and was lying prostrate on the turf when referee Scott Duncan waved play on and Moncur saw his 25-yard shot deflected past Frank Fielding.
Taylor had a shot saved as the interval approached, but the half time whistle was greeted with loud booing from home supporters, much of it directed at the match officials.
Barnsley had to make a change at the break, with Callum Evans replacing centre-back and captain Marc Roberts. Evans slotted in at left-back, with Gethin Jones moving to the middle.
City began the second half strongly with Abraham heading wide and Taylor shooting just over from 20 yards.
Abraham levelled after 53 minutes with his 26th goal of the season, a close-range finish after Matt Taylor's initial effort from a Josh Brownhill head down had been blocked.
The goal transformed the mood at Ashton Gate. The hosts poured forward and created several chances without finding a finish.
Instead, in the 64th minute, Bailey Wright gave the ball away and Armstrong raced forward to feed Moncur, who hammered an unstoppable shot past Fielding
Back roared City again four minutes later. The Barnsley defence were caught out by a long ball and Paterson coolly lobbed a second equaliser.
And when Paterson delivered a right-wing corner Flint rose majestically to power home a head from the edge of the six-yard box to spark wild celebrations at the end.