Bristol City moved level on points with third-placed opponents Fulham thanks to a 2-1 win at Craven Cottage in the Sky Bet Championship.
Robins captain Josh Brownhill opened the scoring in the first half and Famara Diedhiou added a second with 14 minutes left.
And they held on to end Fulham's four-match winning run despite Aboubakar Kamara reducing the arrears late on in a frantic and bad-tempered finale of penalty appeals and near-misses.
Fulham's first serious attack came after nine minutes. Stefan Johansen spotted the run of Ivan Cavaleiro and chipped the ball over the City defence and into his path, but goalkeeper Daniel Bentley was swiftly off his line to get enough of a touch on Cavaleiro's shot to allow Jack Hunt to clear.
Six minutes later the visitors should have taken the lead. A lucky bounce fell for Andreas Weimann and he spread the ball out to Niclas Eliasson on the right. His cross was met by Diedhiou six yards out but his header was straight at goalkeeper Marek Rodak, who clutched the ball at the second attempt.
But after 26 minutes they were ahead. Fulham probably thought they had cleared an initial attack but Eliasson, on the left this time, collected the loose ball and returned it into the centre, where Brownhill headed his fifth goal of the campaign firmly past Rodak from eight yards.
Fulham tried to hit back but were too ponderous with their attacks. Even when a clever feint by Cavaleiro left two defenders on their backs, he took too long to decide what to do next and the chance was gone.
They looked sharper after the interval and Anthony Knockaert scampered clear of the City defence only for Bentley to block his shot with his legs.
Then Fulham top scorer Aleksandar Mitrovic missed two good chances, nodding Joe Bryan's cross high from six yards, then stretching out a leg in a vain attempt to reach Knockaert's deflected cross.
But City doubled their lead after 76 minutes with a superbly-worked team goal. Brownhill's clever back-heel released Adam Nagy, who slid the ball across goal for Diedhiou to tap in his sixth goal of the season in all competitions.
Fulham pulled one back four minutes from time thanks to two substitutes. Bentley parried a shot be Neeskens Kebano but Kamara hit home the rebound.
But there was plenty of drama yet to come. The Fulham players surrounded referee Jeremy Simpson and demanded a penalty in added time when Kebano fell under challenge from Callum O'Dowda.
And there was still time for Kebano to head against the crossbar as the Robins held on.
What the managers said...
Fulham boss Scott Parker: "The referee has obviously made a big mistake and that can happen, human error. That's when you want VAR in the Championship. Probably it is an instant reversal of the decision. But I am proud of my team. Three or four weeks ago we lost to Hull City here and the stadium cleared out. The fans lost a bit of belief that we could get back in it and I sensed the players did as well.
"At 2-0 down today with 10 minutes on the clock, we were in the ascendancy and didn't give up, they kept going. On another day, the one that hits the bar, the penalty decision, it could turn a different way. I'm proud of the players today."
Bristol City boss Lee Johnson: "I haven't seen the penalty back but I don't need to. I spoke to our player, Callum O'Dowda, and he felt he pulled away and pulled out. Obviously that is a player's word for it and I'm sure that if the roles were reversed then I would have a different opinion.
"It was a heart-in-the-mouth moment. But we deserved the win. In the first half, I thought we were absolutely outstanding and we limited them to not a lot and created a couple of really good chances ourselves. The second goal was as good as you will see at this level."