Harrison Burrows grabbed a last-gasp winner for Sheffield United to move Chris Wilder’s side to second in the Championship table.
There was a dramatic finish at Ashton Gate which saw Ryan One equalise with four minutes of normal time to go, Bristol City go a man down when Robert Dickie saw red and then the visitors net the winner with seconds left.
Burrows’ finish - a left-foot rocket past Max O’Leary in the Bristol City goal - delivered all three points to send the Blades ahead of Leeds and behind Sunderland in the table.
Bristol City had taken the lead on 75 minutes from the spot after Michael Cooper upended Sinclair Armstrong and Anis Mehmeti converted from 12 yards.
But Wilder’s men showed great character to fire back late.
On a night when all the fireworks seemed to have been restricted to before kick-off, this was a slow burner of a game.
Yet from 75 minutes, when Sinclair Armstrong was hauled down by Cooper and Mehmeti calmly converted, sparks began to fly.
At that point Wilder might have justifiably reasoned that this was not to be his night.
His Blades had hit the post in the first half through Gustavo Hamer and his tactical reshuffle backfired when substitute Keiffer Moore limped off within 10 minutes of coming on, six minutes before City's goal.
Yet the hastily enforced change, replacing the Welshman with Scottish 18-year-old One, proved decisive with the striker rising highest to head home and level with four minutes of normal time to go.
If that sparked pandemonium, there was further drama to come with last defender Dickie given his marching orders for hauling down Callum O’Hare when the Sheffield United winger picked his pocket 35 yards out.
Then with mere seconds left of the seven added minutes, Oliver Arblaster picked out Burrows on the left side of the penalty area and the midfielder beat O’Leary inside his far post with a left-foot shot.
Defeat was hard to take for Bristol City manager Liam Manning and his players who dropped a couple of places to 11th in the table.
While a Leeds win at Millwall on Wednesday night could yet put Wilder's side back into third, victory ensures they go into the Steel City derby against Sheffield Wednesday on Sunday brim full of confidence off the back of three straight wins.
Blades manager Chris Wilder speaking to BBC Radio Sheffield:
"To get a result is fantastic and when you get those moments in a game, in a season or in a career they are a little bit special.
"I didn’t think it was a smash and grab. I thought it was a tight game against good opposition and one where we needed to raise our levels at half-time.
"We had been wanting to get Ryan One on the pitch and he took that opportunity. Why it took the last 20 minutes for us to play with more drive and intensity I don't know but you have to give the players an enormous amount of credit.
"The lads were incredibly brave, we flooded it and really went for the winner and we got a memorable winner and memorable scenes for the supporters who have travelled a long way down here."
Bristol City manager Liam Manning speaking to BBC Radio Bristol:
"You have to come away with something but there were so many good aspects to the performance you can’t really knock the lads' attitude, work rate or desire to compete.
"When you are ahead it is how do you manage those high-pressure situations and that is the bit we didn’t do.
"It feels like we lost it rather than they won it. But you have to stay calm and composed to see out the game. The last couple of minutes is what cost us.
"The lads are gutted and rightly so, but we have to move on. We are on a really good run and we have shown against a strong side tonight that we can compete with anybody again.
"We have to bounce back and go again Saturday."