Pablo Hernandez scored twice as Leeds twice came from behind and overcame a missed penalty to secure a crucial 3-2 victory against Millwall at Elland Road.
For a long time it looked as if Leeds would back up their crushing defeat to promotion rivals Sheffield United with another highly-damaging result.
But Hernandez – controversially overlooked for the Sky Bet Championship team of the season – hauled Leeds from the brink with a brace in an inspirational performance.
Ben Thompson gave Millwall a deserved early lead and it appeared as if it would be another painful afternoon for Leeds when Patrick Bamford missed from the penalty spot.
But Hernandez equalised before the break and then scored the winner after Luke Ayling had cancelled out Ben Marshall’s spot-kick.
The biggest cheer of the day came at full-time when Sheffield United’s home defeat by Bristol City was announced, a result which leaves Leeds two points clear of the Blades.
Millwall suffered FA Cup heartbreak last time out and they started like a side determined to put the penalty shootout loss quickly behind them.
Leeds were given a warning when Marshall had a shot blocked inside the opening 20 seconds and had another escape as Bailey Peacock-Farrell – in for the suspended Kiko Casilla – pushed Jed Wallace’s effort wide.
Millwall were rewarded after 10 minutes when Mahlon Romeo crossed from the byline and Thompson – scorer of both goals in their last win at Birmingham – nodded in from close range.
The goal sparked Leeds into life and they had a golden opportunity to strike back when Ezgjan Alioski was tripped in the penalty area by Wallace.
Bamford, who scored from the spot against Bolton, stepped up and went down the middle but his weak effort was kept out by the legs of former Leeds goalkeeper David Martin.
Despite the miss Leeds were playing with greater fluency and had another gilt-edged chance when Jack Harrison was left one-on-one by Hernandez’s sublime through ball, only for him to be denied by Martin’s footwork.
The equaliser eventually came in the 34th minute at the end of Leeds’ best move of the match.
Captain Liam Cooper snuffed out a dangerous Millwall attack at one end and United quickly moved the ball into midfield before creating space on the right where the overlapping Ayling cut the ball back for Hernandez to lash home.
Tyler Roberts had a curling shot saved by Martin as Leeds sought a second before half-time.
Millwall went into the break level and were gifted an opportunity to restore their lead when substitute Barry Douglas gave the ball away before Marshall was brought down at the end of a rapid break.
Marshall sent Peacock-Farrell the wrong way to make it 2-1 after 55 minutes and Leeds had a mountain to climb.
Pontus Jansson flirted with a red card before he was hooked for exciting winger Jack Clarke in an attacking move by boss Marcelo Bielsa.
Leeds had Millwall penned in and they were level again when Harrison refused to give up on a seemingly lost cause and allowed Douglas to cross for Ayling to power a header beyond Martin.
The Whites had 20 minutes to find a winner and they got it seven minutes from time as Roberts delivered a low cross from the byline for Hernandez to slide in and send the home fans wild with delight.