Conor McAleny scored twice on his first Brentford appearance as The Bees came from 2-0 down to beat Premier League Cardiff City at Griffin Park.
After a tricky start Brentford had the better of the pre-season friendly against the South Wales side and probably deserved to win.
They fell two down as Cardiff scored twice in a minute early in the first half but McAleny, on loan from Everton, pulled one back late in the opening 45 and then equalised soon after.
Paul Hayes scored the winner in the dying seconds to give The Bees victory four days before they start their Sky Bet League One campaign away to Port Vale.
McAleny fired over within 30 seconds on his first appearance at Griffin Park but the Premier League side started well.
The Welsh outfit looked a well-drilled, slick team and with Jordon Mutch shielding the defence and Kim Bo-Kyung finding space and making it difficult to pick him up, the visitors took the early initiative.
Last season’s Championship champions had a strong starting XI and it showed in the first 20 minutes as they dominated possession and territory.
Craig Noone had a shot blocked before David Button saved well from Frazier Campbell and went full stretch to deny John Brayford.
Mutch shot wide for Cardiff but Brentford almost edged ahead when a corner reached George Saville, he fired in a low shot that Craig Bellamy cleared off the line.
But that was a rare Brentford attack in the first 20 minutes and Cardiff hit The Bees with two quick goals.
The first came when a defensive slip allowed Campbell to feed Noone, he crossed for Bo-Kyung to head home from close range.
Moments later Brentford lost the ball in midfield, Bo-Kyung ran through and fed Campbell, the striker steadied himself and placed the ball calmly past Button and in to the corner.
Andrew Taylor had a shot deflect wide and then one blocked as the visitors threatened to run away with it and Peter Whittingham missed the target from distance.
But Brentford Manager Uwe Rösler changed the shape of his side, pulling Adam Forshaw and McAleny wide in a 4-4-2, and the game changed.
The Bees should have pulled one back when Forshaw crossed and Clayton Donaldson met it with a powerful downward header but Joe Lewis saved superbly to his right.
McAleny fired over after a nice turn and Donaldson headed wide again while a Saville free kick was just about kept out by Lewis.
Bellamy and Campbell missed the target from distance for Cardiff but the momentum had shifted and Brentford had the upper hand.
Ben Turner headed wide for the visitors before McAleny had a shot blocked and just before half time, Brentford were back in it.
Saville attacked from midfield and fed a pass to the left, McAleny cut inside and shot in to the far corner past Lewis to halve the arrears.
Brentford would have felt they had the ascendency going in to half time and they were level within four minutes of the re-start.
Will Grigg fed the ball in to the path of McAleny; he twisted and turned his way past Ben Turner before firing low past Lewis to equalise.
The Bees could have been ahead minutes later when McAleny picked up a loose ball from a cleared Cardiff corner and hared away, unfortunately he delayed his pass and when he found Saville defenders were back to block.
Kevin O’Connor blocked a Bo-Kyung shot and Noone fired a free kick over before a plethora of substitutions affected the flow of the game.
Brentford probably still had the better of it and could have gone ahead when a Donaldson cross was met by Mark Hudson and was heading towards the corner before Lewis got down to turn it away.
Martin Fillo had a shot blocked and a weak Toumani Diagouraga effort was saved while at the other end a Noone shot deflected wide and Matthew Connolly headed wide from the resulting corner.
Another Noone effort missed the target for the visitors while Nicky Maynard missed a great chance but fired at Alan McCormack when ten yards out and with the goal at his mercy.
Shaleum Logan shot wide for Brentford and Joe Mason missed the target from ten yards after exchanging passes with Maynard.
Sam Saunders curled a free kick wide for Brentford and Fillo almost made Lewis pay for dithering in possession when he got in a tackle only for the goalkeeper to recover and deny him.
Brentford were not, however, to be denied.
After a sweeping move, Stuart Dallas put in a cross, Lewis failed to gather and Hayes scored from close range to win it.
Brentford: Button (sub Bonham 61 mins); Logan, Dean, O’Connor (sub Reeves 71 mins), Bidwell (sub Venta 61 mins); Forshaw (sub Fillo 61 mins), McCormack, Saville (sub Diagouraga 61 mins); Donaldson (sub Dallas 81 mins), Grigg (sub Hayes 71 mins), McAleny (sub Saunders 61 mins)
Sub (not used): Pierre
Cardiff City: Lewis; Brayford (sub Connolly 61 mins), Hudson (sub McNaughton 76 mins), Turner (sub Nugent 76 mins), Taylor (sub John 61 mins); Mutch (sub Ralls 76 mins); Noone (sub O’Sullivan 83 mins), Bo-Kyung (sub Mason 61 mins), Whittingham, Bellamy (sub Conway 61 mins); Campbell (sub Maynard 61 mins)
Sub (not used): Marshall
Attendance: 2,954 (580 away fans)
By Chris Wickham