Bristol City mounted a stirring late response to beat Sheffield Wednesday 3-2 in the battle of the npower Championship strugglers which leaves Owls boss Dave Jones clinging on to his job.
Jones, who saw his side come into the game on the back of six successive defeats, had received a vote of confidence from Milan Mandaric a fortnight ago, and he looked to be overseeing a home win until the Robins' late show.
Wednesday were leading 2-1 with 12 minutes to go thanks to goals from Miguel Llera and Gary Madine, though Llera's involvement did not end there.
The Portuguese defender gave away a penalty to allow Sam Baldock to equalise at 1-1 and then another six minutes after Madine's goal.
Then, just a minute after Baldock had levelled for the second time from the spot, Albert Adomah curled in a fine 22-yard free-kick to put Derek McInnes' side ahead.
The drama was not done there, though, as after Wednesday appealed for a penalty, Madine slammed home the ball, but referee Andre Marriner, who had caused Jones much chagrin throughout the afternoon, ruled out the effort and awarded a free-kick to City.
And there was no coming back from that for Wednesday, who slumped to a seventh defeat on the bounce, which Jones will do well to survive.
The win was City's third in the last 15 games and keeps them in touching distance of those teams just above the drop zone.
It had been the perfect start for Wednesday as they went in front with just two minutes on the clock.
After early pressure Chris Lines curled an inviting corner into the six-yard box for Llera to meet it with an unstoppable header.
The Owls were far better all over the park and they should have had a further two goals inside the opening 10 minutes.
First Madine fired in a weak effort when being fed by Chris O'Grady and then O'Grady himself missed a fine chance when he was stretching after Jermaine Johnson had left Liam Fontaine on his backside.
But out of nothing the Robins found themselves level in the 17th minute. Baldock received the ball into his feet in the penalty area, he turned Llera and the big centre-half brought him down.
Marriner pointed to the spot and Baldock calmly sent Chris Kirkland the wrong way.
Both sides clearly knew the importance of a win and went for it in an open second half.
Baldock fizzed an effort just wide from a training-ground corner while Johnson's cross for Wednesday was deflected just over with at least two men waiting to knock it in.
Chances continued to come at both ends with Baldock forcing Kirkland into a fine save from 16 yards and then Madine spurning a superb chance from eight yards, shooting straight at Tom Heaton.
But it was City that began to take control and Adomah wasted a great chance to set a team-mate up at the byline but he picked out nobody and then Fontaine and Neil Danns had efforts go close.
However, Wednesday weathered the storm and hit City on the break to regain the lead in the 78th minute.
Johnson broke at pace, making up yards of ground, and fired a low shot that was too hot for Heaton to handle and Madine atoned for his earlier misses by slotting home the rebound from eight yards.
It was harsh on City, but they were back on level terms again just six minutes later through another Baldock penalty, this time after Llera had handled.
And two minutes later Adomah curled a superb effort in from a free-kick to pour the misery on Wednesday, which was made even worse by the late controversy.