A goal deep into injury time from towering striker Julian Alsop sealed all three points for ten-man Cheltenham Town and lifted them out of the bottom four in Division Two for the first time since September.
Nearly a minute of added time had elapsed when Richard Forsyth supplied Martin Devaney down the right-hand side. The tricky wideman had been a thorn in Brentford's side all game and he delivered a beautifully inviting cross for Alsop to head past goalkeeper Paul Smith.
Up to that point Smith had been Brentford's man of the match, making a series of good saves and displaying sound handling against a tenacious Cheltenham team.
The home side once again belied their lowly status with some confident passing and movement and were unlucky not to score before they did. Their industry was undimmed even after Grant McCann was sent off in the 67th minute for raising his arm in a clash with Brentford's Martin Rowlands.
McCann had seen his loan from West Ham extended only the day before and he will now miss three games of the next month.
Brentford, whose young side had risen to seventh in the table before the game, were off colour for much of the game and were unable to give Cheltenham many problems even after the sending-off.
Their best chance resulted from a good run and cross by Kevin O'Connor but Stephen Evans shot wastefully over the crossbar.
“There were two very competitive sides and the game opened up second half,” said Cheltenham manager Graham Allner.
“I thought we just about deserved the win in the end and it was a great goal.
“I'm not sure about the sending-off and will need to think about whether we are going to appeal.” Brentford boss Wally Downes said: "I thought Cheltenham were comfortably the better side in the first half and we had a spell where we were okay in the second.
“I've no complaints about the result.”