Ben Strevens scored a late winner as Brentford extended their unbeaten run to ten with a victory over relegation-threatened Tranmere Rovers.
The Bees took the lead in a competitive, and sometimes ill-tempered, match that sprung to life after half time.
Rovers levelled soon after and looked as if they would hold on for a point as Brentford pressed for a winner.
But Strevens struck with four minutes remaining to move The Bees into the top ten in League One.
Tranmere started like a team that had to win - as they were - and most of the early action was in the Brentford final third.
Wojciech Szczesny reacted well to tip an Ian Thomas-Moore effort over the top and then saved a Bas Savage header easily.
Joss Labadie lashed over for the visitors and Craig Curran saw a header saved but despite early possession, Tranmere hadn't created anything to unduly worry Brentford.
They probably had the better of a first half low on quality, their narrow 4-3-3 system making it difficult for The Bees, but when Brentford were able to get the ball wide, they prospered.
A good run and cross from Myles Weston on the left set up a shooting opportunity for Carl Cort, but Ian Goodison blocked, and when another cross was half cleared, Sam Wood found space in the box, only to shoot wide from 14 yards.
Labadie shot well over again for Tranmere and Savage went close when he cut inside and shot low, it deflected off team-mate Gareth Edds but dribbled narrowly wide.
At the other end, a fine effort from Lewis Grabban flew inches over and a flicked Weston header was saved by Peter Gulacsi before Curran shot straight at Szczesny after good work by Thomas-Moore.
The visitors ended the half on the front foot - Thomas-Moore had a shot deflected over and then one saved by Szczesny, who also saved an Edds header, but Brentford, who had to replace Carl Cort with Strevens late in the half, should have had a penalty when a Wood cross bounced up and hit the arm of Zoumana Bakayogo inside the area.
However, nothing was given, and the half ended justifiably all square.
But within four minutes of the re-start, the deadlock had been broken.
Grabban had already fired wide for Brentford before Weston and Wood combined on the left - the latter put in a cross that was half cleared, Toumani Diagouraga fired it back, only for Goodison to block, this time O'Connor got a shot in that bounced through a crowd of bodies and rolled past Gulacsi.
The Bees started the second half very well, with Weston and Wood combining to great effect on the left.
Another fine move down that flank lead to Wood cutting it back to Charlie MacDonald, his low shot was blocked, again it fell to O'Connor who this time hit it much firmer but it was again blocked - although it looked like it hit the arm of Ash Taylor.
Weston curled an effort narrowly wide and then saw a weak shot saved by Gulacsi while Thomas-Moore had a header saved at the other end.
But, just past the hour mark, against the run of play, Tranmere levelled.
They were awarded a free kick 25 yards out which Labadie lashed into the defensive wall, it broke back to him and his sweet left footed effort flew past the unsighted Szczesny and into the net.
The equaliser - and the nature of the protests by Thomas-Moore that saw Karleigh Osborne booked for a clumsy but not malicious foul on Labadie, not the first time the Tranmere captain had badgered the officials - brought the game to life.
Brentford went in search of a winner - Wood fired over, Weston shot wide and Diagouraga came within a whisker of opening his account for The Bees with a low shot that was superbly tipped away by Gulacsi, only for the increasingly erratic officials to give a goal kick.
Tranmere also looked for the crucial goal, but to less effect - Thomas-Moore had a shot blocked and Andy Robinson saw a volley land on top of the net.
And soon after, Brentford got the winner.
Wood was involved again, picking up a Strevens lay off and feeding MacDonald - the striker turned Goodison and pulled it back for Strevens to score his sixth of the season.
The Bees could have sealed it but Gulacsi saved well from a low MacDonald shot and when Strevens set Lionel Ainsworth free his shot was blocked and Weston lifted the re-bound over.
And Tranmere almost profited - Szczesny saved well from a low Labadie cross-cum-shot and then superbly tipped a Marlon Broomes header over the bar.
That save proved to be enough to give Brentford the win.
Brentford: Szczesny; Foster, Osborne, Legge, Wood; Grabban (sub Ainsworth 85 mins), Diagouraga, O'Connor, Weston; Cort (sub Strevens 44 mins), MacDonald
Subs (not used): Bull, Blake, Hunt, Saunders
Bookings: Osborne (61 mins) (third of season)
Tranmere Rovers: Gulacsi; Broomes, Goodison, Taylor, Bakayogo; Edds (sub Bain 88 mins), Welsh, Labadie; Savage (sub Robinson 75 mins), Thomas-Moore, Curran
Subs (not used): Coughlin, Mahon, Gornell, Barnett, Gordon
Bookings: Welsh (68 mins), Thomas-Moore (82 mins)
Attendance: 4,341 (225 away fans)
By Chris Wickham