The Whites, for a second time in five days, required a goal deep in added time in LS11 to secure a positive result on home soil.
Marcelo Bielsa's side caused more chaotic scenes thanks to the returning Bamford, who was handed his first appearance since mid-September due to an ankle injury.
The 28-year-old forward reacted quickest to a flick on from a Raphinha corner to turn the ball home from his knee off the underside of the bar.
The strike came in the fifth minute of injury-time on his comeback and helped move Leeds six points clear of the top flight drop zone.
United's No 9 was introduced from the bench with around 20 minutes to go after the Bees had turned the game on its head in the second half.
Brentford trailed following a Tyler Roberts opener on his 100th Whites match but goals from Shandon Baptiste and Sergi Canos put Thomas Frank's outfit ahead.
Leeds battled back and grabbed a stunning draw just seconds before time expired which caused more wild scenes in the home stands.
"I always felt when I came on the pitch I was going to get one chance," Bamford reflected at full-time, with a smile on his face.
"It didn't come for ages and ages but I still thought there was time. [Adam] Forshaw said to me that I was going to get one chance and it came.
"The message [from the bench] was just to just try and give a presence in the area and spin behind, don't drop too short and just try and do what you can.
"I just tried to stay in the box as much as I could and hope I put myself in the right position."
Here, we take a look back at another eventful afternoon through the camera lens...

7. Whites fans watch on
The home crowd watch on from the Elland Road stands as Leeds head into the half-time interval a goal ahead. Photo: Tony Johnson

8. Brentford fightback
Two quickfire goals for the visitors turn the game completely on its head. Leeds trail 2-1 on the hour... Photo: Tony Johnson

9. Bielsa barks instructs
Desperately trying to give his side a boost, Patrick Bamford enters the game with around 20 minutes to go. Phillips and Cooper had earlier limped off. Photo: Tony Johnson

10. Bamford scores
Luke Ayling's near post flick on finds the knee of Patrick Bamford. The ball hits the underside of the bar, while Elland Road erupts. Photo: Tony Johnson


12. Ayling goes mad
A lovely way to sign off his return. A solid celebration with the south stand, too. Photo: Getty