Leeds lost captain Liam Cooper to injury inside the opening quarter of an hour but United went ahead in the 27th minute when Tyler Roberts flicked home a Raphinha cross.
Brentford equalised nine minutes after the break as Shandon Baptiste converted from the middle of the box, shortly after United star Kalvin Phillips had pulled up injured and was eventually replaced by Mateusz Klich.
The Bees then bagged what looked set to prove the game's winning goal seven minutes later when a Bryan Mbeumo through ball played in Sergi Canos who smashed home a clinical finish past Illan Meslier.
But Bamford returned from two and a half months out through an ankle injury as United's third and final substitute in the 68th minute and kneed home a corner in the 95th minute with a finish that flew in off the underside of the bar.
Graham Smyth, the YEP's chief football writer, hands out the scores from another dramatic game at Elland Road.