Leon Clarke was the hero for Oldham as he snatched a late brace to give John Sheridan's high-flying visitors a dramatic draw in a four-goal thriller at Griffin Park.
With five minutes to go, Brentford looked to be cruising to victory after Joe Keith curled in a superb effort from the right of the area to put the Bees two up following Garry Richards' 59th minute opener.
But promotion pushers Oldham struck back immediately with the outstanding Clarke pulling a goal back with a close-range header before converting an injury-time penalty after Sam Tillen was adjudged to have handled in the area.
It was the second week in succession that Oldham had pulled back a two-goal deficit in the closing minutes with Leyton Orient being the Latics' victims last time round.
But if Clarke's late intervention gave Oldham's play-off aspirations an unlikely boost, it was a heartbreaking blow for second-from-bottom Brentford in their battle to avoid the drop.
The late drama was a fitting conclusion to an end-to-end encounter played at a high tempo from the outset.
Both sides had numerous chances to add to their goal tally, but opportunities went begging at either end.
Clarke and Chris Taylor missed decent early chances for Oldham before Richie Wellens rattled the woodwork with a superb curling effort from the edge of the area.
Brentford missed two glorious first-half opportunities when first Neil Shipperley nodded Keith's free-kick tamely into the arms of goalkeeper Les Pogliacomi before Michael Leary drove a shot on to the underside of the bar with half-time beckoning.
Brentford came out with renewed purpose after the interval and soon took the lead.
With 59 minutes gone, Keith sent in an inswinging corner from the right and Richards rose to send a glancing header across Pogliacomi.
Brentford continued to press and five minutes from time the pressure told.
Keith collected a John Mousinho pass on the right of the penalty area before sending a long-range curler into the top right-hand corner.
But Oldham were not finished and seconds later Clarke bundled home an equaliser from Paul Warne's cross to set up a thrilling finale.
Brentford looked set to hold out, but deep into injury-time came the final twist.
Tillen was adjudged to have handled in the area and Clarke stepped up to slot home from twelve yards as Oldham got out of jail for the second week in succession.