Nathan Elder scored the winning goal on his debut five minutes from time to give Brentford their fifth win in six matches and their third away win on the bounce.
The powerful striker raced clear, having sprung the Mansfield Town offside trap, to pick up a deflected Ricky Shakes pass and slot past Stags' stopper Carl Muggleton and hand The Bees the points.
It completed an interesting afternoon for the debutant, who scored the opening goal of the game in his own net, and rounded off a rip-roaring match which was a fine spectacle and a great advert for League Two football.
The home side probably had the better of the first half and deserved to be ahead before they took a 15th minute lead.
Stags' skipper Jake Buxton headed a Matthew Hamshaw cross against the crossbar, Gary Smith cleared the re-bound from John Mullins off the line and prolific striker Michael Boulding pulled a shot wide soon after.
But Mansfield did score when a Hamshaw free kick was flicked on by Boulding and deflected past Ben Hamer by Elder.
The Bees hit back, with Elder leading the line and the fight back, Alan Connell flicked a header narrowly wide, Muggleton saved superbly from a deflected Glenn Poole effort and Gareth Jellyman cleared with Shakes ready to pounce.
Muggleton saved superbly from an Elder header soon after but could do nothing to prevent Kevin O'Connor equalising with a beautifully curled free kick from 25 yards.
The home side finished the first half brighter, Boulding had a shot blocked and forced Hamer into a low save before Stephen Dawson fired wide.
But Brentford could have gone in a head when a fantastic Connell dummy created space for Smith and Muggleton had to get down low to deny the Brentford midfielder.
That was a taste of what was to come as Brentford flew out of the blocks in the second half, Smith fired just wide and Elder had a shot blocked and header saved before the visitors edged ahead with a delightful goal.
Ryan Dickson, Poole and Smith teased the Mansfield defence in the inside left channel before the latter threaded a pass through to Connell who turned and fired past Muggleton first time with his left foot.
But Mansfield refused to be beaten.
Substitute Jefferson Louis almost created an opening for Dawson before Buxton headed wide soon after as they pressed forward.
And Louis pulled them level with 26 minutes remaining when Boulding bulldozed his way through and the ball broke kindly for the recently introduced striker.
The game was finely poised and it was Brentford who took control, Shakes forced a fine low save from Muggleton as they tried to grab the killer goal before Elder did so late on.
Mansfield had their chances, a Hamshaw free kick flew inches wide and Louis had a shot deflected wide but they could not fight back once Brentford grabbed their third goal.
And Connell could have made it four when his shot, after nice play by Shakes, was cleared off the line.
Elder and Jordan Parkes almost added the crucial goal late on but it proved not to matter as Brentford continued their fine run of form.
Mansfield Town: Muggleton; Wood, Mullins, Buxton, Jellyman; Hamshaw, Bell, Dawson, D'Laryea (sub Atkinson 57 mins); Holmes (sub Louis 57 mins), M. Boulding
Subs (not used): White, Brown, Arnold
Bookings: Buxton (53 mins)
Brentford: Hamer; Pead, Heywood, Sankofa, Dickson; Shakes (sub Montague 90 mins), O'Connor (sub Stone 79 mins), Smith, Poole (sub Parkes 76 mins); Connell, Elder
Subs (not used): Simon Brown, Osborne
Attendance: 2,411 (422 Bees fans)
Written by Chris Wickham