Bobby Reid netted his seventh goal of the season as Bristol City romped to a thrilling 4-1 Sky Bet Championship victory over Derby at Ashton Gate.
The visitors went ahead from the penalty spot on 27 minutes as Matej Vydra thundered the ball home off the underside of the crossbar after being brought down by City goalkeeper Frank Fielding.
But the hosts levelled five minutes after the break when Cauley Woodrow netted with a downward header from Joe Bryan's left-wing cross.
Reid made it 2-1 with the second penalty of the match in the 55th minute, sending Scott Carson the wrong way after Jonathan Leko had been tripped by Richard Keogh.
Jamie Paterson put the result beyond doubt with an 83rd-minute free-kick from 20 yards that bounced down off the crossbar, goal-line technology proving the ball had crossed the line before being cleared.
Substitute Famara Diedhiou set the seal on an exhilarating display by Lee Johnson's men in stoppage time, shooting home from a brilliant long ball by Paterson.
Both sides looked committed to attack from the outset and an entertaining first half was packed with incisive moves. Reid just failed to clear advancing goalkeeper Carson with a header after Keogh's poor back-pass had put Derby in trouble.
A Vydra free-kick from 20 yards on 12 minutes clipped the outside of a post after City centre-back Nathan Baker had clipped Tom Lawrence. Carson was the first-half hero for Derby, making the first of several saves in the 21st minute to keep out a Woodrow shot.
Fielding escaped without even a yellow card for the foul on Vydra that brought the penalty, presumably because referee Martin Atkinson deemed that the striker was heading away from goal.
The home side upped their game after going behind and Leko should have marked his first start with a goal in the 32nd minute. The loanee attacker from West Brom moved unmarked onto a Woodrow cross, but his shot was at a good height for Carson, who beat it away.
There was a better save from the Derby goalkeeper 10 minutes later as he went full-length to palm away a glancing header from Paterson. Reid had the ball in the net for City just before the break, but referee Atkinson had already whistled for a foul on Paterson just outside the box.
The hosts began the second half well as Marlon Pack fired narrowly wide from 30 yards and Woodrow's equaliser was no more than they deserved.
Derby claimed a foul by Bryan before he delivered the cross, but had no complaints about City's penalty that followed. After both sides had made double substitutions, the all-action contest continued with Bradley Johnson heading inches wide for Derby and Lawrence seeing a deflected free-kick held by Fielding.
Lee Johnson: "We don't want to get ahead of ourselves, but I was delighted with what I saw even in the first half. At the interval I just told the players to produce more of the same. The only problem was some of our delivery from crosses and at times we could have got the ball in quicker.
"The second half was everything I want to see from my team. Jonathan Leko is like the Lord of the Dance and I would hate to be a defender playing against him. We always looked a threat going forward and I picked a solid team so we were able to deal with a very good Derby side, who came here on the back of a big win."
Gary Rowett: "We have got to develop an underdog mentality away from home, rather than thinking we can just turn up and pass opponents off the park. We conceded three poor goals at Sheffield United and four more today. I wasn't happy with our defending for any of them.
"From the start we failed to match Bristol's intensity or handle their forward play. At half-time I told the players they would need to do much better because we had ridden our luck to be in front. It seems that when games are going nicely for us we are fine, but we have to be far more resilient. Bristol played well, but I felt sorry for our travelling fans and the only message I want to get to them is how disappointed I am with the performance."