Defender Sam Sodje came to Brentford's rescue with a well-taken equaliser to keep them in the FA Cup.
The 25-year-old struck midway through the second half, heading Darren Pratley's corner past keeper Chris Day.
Oldham went in front from the penalty spot 10 minutes after the interval when Richie Wellens was fouled and skipper Andy Liddell scored from 12 yards.
Lloyd Owusu missed easy chances for the visitors in the first and last minutes of the second round tie.
Oldham: Day, Forbes, Haining (Scott 7), Branston, Hughes, Wellens, Butcher, Tierney, Warne, Porter (Beckett 76), Liddell.
Subs Not Used: Cronin, Owen, Eyres.
Booked: Branston.
Goals: Liddell 57 pen.
Brentford: Nelson, O'Connor, Sodje, Turner, Frampton, Brooker (Tillen 45), Pratley, Newman, Tabb, Campbell (Hutchinson 86), Owusu.
Subs Not Used: Rankin, Gayle, Bankole.
Booked: Sodje.
Goals: Sodje 65.
Att: 4,365.
Ref: J P Robinson (E Yorkshire).