Chester City's second-half fightback ended a run of 14 games without a win as they eased their relegation fears and stretched Mansfield's club record home successive defeats to seven matches.
City's hero was two-goal Kevin Ellison, back from a five-match absence through injury. He masterminded the recovery after Mansfield had snatched the lead in first-half stoppage time.
The result left the Stags deep in trouble - second bottom of the Football League - and vastly short on confidence at Field Mill, where they have not won since Boxing Day.
The Stags had squandered five chances in an amazing goalmouth scramble inside the first 30 seconds - and ultimately that proved vital.
Jon D'Laryea's low shot was blocked by the diving John Danby, Jefferson Louis' follow-up flew across the face of goal, Micky Boulding's shot was scrambled off the line by a combination of keeper and post, Will Atkinson was also denied and then Stephen Dawson blazed over in a remarkable start.
In an open start Mark Hughes ran into space inside the penalty area at the other end, but just failed to turn in Tony Dinning's cross. Then, with the home defence again all at sea, Kevin Roberts beat John Mullins and bent his shot wide.
Mansfield, desperate to end their home jinx, began to look nervous in defence as a scrappy first half wore on.
But two minutes before half-time they again went close to the breakthrough. First Boulding was twice denied by Danby and then the keeper reacted well to hold Matt Hamshaw's acrobatic overhead kick.
Hamshaw found himself clear once more, but this time the ball bobbled just as he shaped to shoot and the chance had gone.
However, in stoppage time, the unmarked Mullins rose highest insider the penalty area to powerfully head in Matt Hamshaw's curling corner to give the Stags the lead.
Six minutes into the second half Louis started and almost finished a quick break, just failing to touch in Hamshaw's inviting cross.
Another fine pass from the big striker again released Hamshaw a minute later, but this time Atkinson squandered the final chance.
That proved vital when, moments later, Ellison stooped to head in Ritchie Partridge's fierce left-wing cross and level for Chester.
The Stags almost regained the lead from a well-worked free-kick routine, but the alert Paul Linwood headed Dawson's deflected cross off the line.
And Linwood was in the thick of the action as City completed the fightback to take a 72nd minute lead. Louis was penalised for tripping Linwood in a goalmouth melee and Dinning calmly tucked away the spot-kick.
Mansfield had a let-off two minutes later when John Murphy headed in James Vaughan's free-kick, but the referee ruled out his 'goal' for pushing.
Then the unmarked Hughes blazed a Partridge cross over and Murphy's close-range header was saved as Chester looked to secure the victory.
In the closing minutes the Stags pressed for a leveller, Boulding's flying header landed on the roof of the net and Louis' dipping 20-yard drive skimmed the woodwork.
Then in stoppage time Ellison curled in a stunning third goal to secure Chester's victory and condemn Mansfield to another weekend in the bottom two.