LEEDS United recorded their seventh win from their last nine league games at Elland Road as Kyle Bartley's 89th-minute header saw off Brentford by a single goal.
A dull first half passed without much incident but Leeds bombarded the Bees after the break and finally made the breakthrough with one minute left.
The win elevated the Whites up a place into fifth, above Derby County who drew 2-2 at Fulham.
A very quiet opening ten minutes saw Brentford's top scorer Scott Hogan show pace to burst to the byline but his cross sailed out of play.
At the other end, a left flank delivery from Stuart Dallas also failed to find the desired target.
After good work from Souleymane Doukara and Hadi Sacko earned Leeds their first corner, Charlie Taylor and Sacko then worked the ball to Dallas who fired a 15th-minute effort over the bar.
Brentford's first attempt arrived in the 17th minute when a weak shot from Lasse Vibe in a good position was easily saved by Rob Green.
The Bees again threatened three minutes later when Tom Field's cross was headed goalwards by a diving Hogan but Green was equal to the task.
Brentford then scrambled away a cross from Doukara but the Bees were looking slightly more threatening and went close in the 23rd minute when Nico Yannaris worked some space on the edge of the area but saw his shot deflected just wide.
After another quiet ten minutes, Harlee Dean's long range effort was easily saved by Green but Romaine Sawyers was presented with a better opportunity soon after but wastefully fired over and wide.
The Bees then found the net in the 42nd-minute as Hogan bundled an indirect free-kick over the line but the striker was clearly offside.
Leeds hit back by going their closest yet in the 43rd minute when Kemar Roofe's shot was deflected just wide but in truth there was little to shout about in a pretty dull first half.
Brentford then began the second half on the front foot and after Hogan went down in the area looking for penalty, a free-kick from Woods skipped off the head of Pontus Jansson and fizzed wide.
Kyle Bartley was then booked for tripping the pacy Hogan in the 53rd minute and a few minutes later John Egan put a free header just wide.
Leeds were struggling to get going and Whites head coach Garry Monk then brought on Gaetano Berardi for Charlie Taylor who looked to have picked up a knock in the first half.
But Leeds were then presented with a fine chance to take the lead shortly after the hour mark when a Dallas corner found Ayling inside the area but the full back lashed a wild effort over the crossbar.
The Whites were gradually turning up the heat and United then squandered an even better chance in the 67th minute when Dallas played in Doukara one-on-one but the striker rolled a low effort from the left side of goal just wide of the right hand post.
The Brentford goal was beginning to live a charmed life and Ayling then squandered another fine chance in the 71st minute when firing just wide from inside the area after great work from Sacko to keep the ball in play.
Monk then brought on Liam Bridcutt for Phillips with 18 minutes left, shortly after Egan had crunched into Roofe to receive a yellow card when home fans were baying for a red.
With just over ten minutes left, Monk then made his final change in bringing on Marcus Antonsson for Doukara.
From a rare Brentford attack, Ayling then turned a dangerous cross behind for a corner in the 81st minute.
But Leeds continued to pile on the pressure and fine work from Sacko earned the Whites an 89th-minute corner.
And it was from that 89th-minute set piece that United finally broke the deadlock as Kyle Bartley rose highest to head home in front of a delighted Kop.
Leeds then had to see out four minutes of added time and Brentford came within a whisker of bagging a 94th-minute leveller when Josh McEachran's overhead kick clipped the crossbar.
But Bartley's header had ultimately won the day, giving Leeds the perfect early Christmas present.
Leeds United: Green, Ayling, Bartley, Jansson, Taylor (Berardi 58), Vieira, Phillips (Bridcutt 72), Sacko, Roofe, Dallas, Doukara (Antonsson 79). Subs not used: Silvestri, Cooper, Grimes, Mowatt.
Brentford: Bentley, Colin, Egan, Dean, Bjelland, Field (Barbet 83), Vibe (Kaikai 79), Yennaris (McEachran 72), Woods, Sawyers, Hogan. Subs not used: Bonham, Saunders, Hofmann, Kerschbaumer.
Referee: Darren Bond.