Mark Warburton's side recorded a fourth-successive win as two goals in the final nine minutes subjected Fulham to a first league defeat since Kit Symons took full control last month.
A tense first half failed to produce a goal, but three minutes before the hour Fulham took the lead through Hugo Rodallega, the Colombian converting Ross McCormack's cross.
Their lead lasted until the 81st minute as Brentford's pressure finally told, Harlee Dean firing a Stuart Dallas delivery into the top corner from the edge of the penalty area.
With full time approaching, and a draw looking likely, Brentford snatched all three points as Jota Peleteiro's strike deflected off Dan Burn in stoppage time.
Meanwhile, Cardiff City moved closer to the play-off positions with a 2-1 victory over 10-man Reading.
After two games without a win Russell Slade's side got back to winning ways thanks to two goals in the first half, with Reading defender Alex Pearce having 45 minutes to forget.
The 26-year-old diverted a Peter Whittingham corner into his own net on 20 minutes, and in first-half injury time he was shown a straight red card for fouling former Reading striker Adam Le Fondre in the penalty area, referee James Linington consulting with his assistant before dismissing the centre-back.
Whittingham duly converted the spot-kick, his fifth goal of the season, and although Michael Hector pulled one back for the visitors they slumped to a seventh defeat in their last 11 league matches.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.