Debut boy Ricky Shakes pounced with seven minutes left to stun unlucky Bury at Gigg Lane.
The Shakers dominated for long periods, but are still seeking a first home win since last December.
Bury opened brightly against the Londoners. Just six minutes had gone when Nicky Adams drove in a shot which was smartly pushed round the post by Bees 'keeper Ben Hamer.
Skipper Dave Challinor then shot straight at Hamer from just 12 yards, before Charlie Ide responded with a long-range shot which flew just wide.
A thumping header from Bury striker Glynn Hurst was well saved by Hamer, but it was the visitors who went in front against the run of play on 23 minutes.
Paul Morgan fouled Kevin O'Connor just outside the Bury box, and Glenn Poole stepped up to curl home a majestic free-kick right into the top corner.
Bury kept up the pressure though, and on the half-hour mark only a brilliant one-handed save from Hamer kept out Paul Scott's goal-bound shot.
Adams saw a fierce shot bravely blocked by Karleigh Osborne, but at the other end Brentford almost doubled their lead on 42 minutes when Sammy Moore this time curled in a free-kick which bounced behind off the top of the crossbar.
As half-time approached both Ben Futcher and Scott were again thwarted by Hamer saves as Bury went in at the break on top.
There was a great start to the second half for Bury. Just 13 seconds had gone when Adams played in Andy Bishop and he beat Hamer from 12 yards. Adams then tried his luck himself, but fired just over from well outside the box.
Bury's Ben Futcher had a late strike ruled out for offside, before sub Shakes did the business against one of his former clubs.