Middlesbrough edged into the fifth round of the FA Cup after being pushed hard by a valiant Mansfield side.
Dong-Gook Lee claimed only his second goal of the season
Dong-Gook Lee steered into the bottom corner on 15 minutes after the Stags failed to clear Adam Johnson's corner.
Mansfield battled throughout with Michael Boulding smashing the bar from 25 yards and Mark Schwarzer saving well a minute later from his looped header.
But three minutes from the end, skipper Jake Buxton diverted George Boateng's clipped cross into his own net.
The lowest-ranked league club still in the FA Cup deserved at least a replay from this tie and will rue their inability to create more chances for Boulding.
Boro themselves failed to fashion many clear-cut opportunities, but after a scrappy opening 15 minutes, they went ahead after a mix-up in the Stags defence.
Mansfield failed to deal with Johnson's corner, and while David Wheeter's shot was blocked, they could not keep out Lee's effort that was comfortably dispatched into the bottom corner.
The blustery conditions meant an aerial bombardment was out of the equation, but early on at least, the hosts were more than adept along the ground, displaying an encouraging spell of passing.
But with little service to lone striker Boulding, Mansfield's chances were heavily restricted.
Boulding - who has scored more goals this season than the entire Boro starting line-up - took it upon himself to find an equaliser and the striker created two excellent chances inside a minute.
First, he rattled the bar from 25 yards after a foraging run from midfield, and from the resulting corner, he leaped to force Schwarzer into a fine full-stretch save.
Lee missed a glorious chance to put the game beyond Mansfield shortly before the break when he somehow headed Jeremie Aliadiere's cross well wide when it looked easier to score.
Mansfield ruffled the visitors throughout much of the second half with Robert Huth - lucky to be on the field after crunching into Boulding - forced into mistakes by the same lively striker.
Boro threw on first-teamers Boateng, Mido and Stewart Downing as boss Gareth Southgate saw his lacklustre team come under heavy pressure.
The hosts grew in confidence and, inspired by Matthew Hamshaw's running and delivery, their endeavour deserved an equaliser.
But the elusive clear chance failed to materialise and Buxton's own goal on 87 minutes ended Mansfield's hopes.
Boateng's clipped cross would have fallen to Downing, but the Stags captain got ahead of him, only to divert the ball into his own net.
Middlesbrough boss Gareth Southgate:
"We knew it would be a difficult test because it is tough at these grounds.
"I am pleased with the way we approached it and getting our first goal settled us down.
"Although it was very windy our goalkeeper and central defenders coped with it very well.
"We could have played better but we the main thing is that we got through.
"Credit to Mansfield because they were never going to give up and they did not."
Mansfield boss Billy Dearden:
"I am proud of the lads although I am disappointed at the two goals we conceded.
"In the second half we pinned them in a bit and did okay.
"We have given a good account of ourselves and hopefully we can take this forward into our league games.
"We must learn from our mistakes especially when defending from set-pieces."
Mansfield: Muggleton, Martin, Jelleyman, Buxton, Mullins, Brown (McAliskey 73), Dawson, D'Laryea, Bell (Arnold 73), Hamshaw, Michael Boulding.
Subs Not Used: White, Holmes, Wood.
Middlesbrough: Schwarzer, Pogatetz (Boateng 46), Huth, Wheater, Young, Cattermole, Arca, Rochemback, Johnson (Downing 65), Aliadiere, Lee (Mido 71).
Subs Not Used: Turnbull, Riggott.
Booked: Huth, Cattermole.
Goals: Lee 17, Buxton 87 og.
Ref: Steve Tanner (Somerset).
BBC Sport Player Rater man of the match: Mansfield's Michael Boulding 8.23 (on 90 minutes).
Please note that you can still give the players marks out of 10 on BBC Sport's Player Rater after the match has finished.