Keeper Matt Glennon was Carlisle's hero as his injury time penalty save kept the Cumbrians in the football league for another week.
Glennon dived to his right to beat away Liam Lawrence's last gasp spot kick after United's brave fight to avoid relegation looked to be over.
Had Lawrence converted his second penalty of the match, awarded for a push by the clumsy Tom Cowan, Carlisle would have been relegated in their centenary year.
After losing a two-goal first-half lead United grabbed the winner in the 66th minute to end Mansfield's hopes of automatic promotion.
Substitute Kelvin Langmead, who had only been on the pitch for five minutes, fired in from 12 yards after good work by Richie Foran.
Afterwards, delighted Carlisle manager Paul Simpson said: "Carlisle has lived on fairy-tales for the last six or seven years, can this be another one? We've kept the dream alive for another week.
"We had to get a win today and the players showed great character."United, roared on by 1,000 travelling fans in a game both sides had to win for vastly different reasons, had started with an adventurous 4-3-3 formation.
Their bold move paid dividends from their third corner in the first 12 minutes when former Mansfield captain Kevin Gray powerfully headed in Brendan McGill's deep flag kick.
Within four minutes they had survived three remarkable scares in a sensational start.
In the 14th minute Lawrence and Junior Mendes carved out a golden chance for Colin Larkin but the unmarked striker hammered against the underside of the bar from six yards.
Then Lawrence's powerful header was cleared off the line a minute later by Foran and just 60 seconds later Lawrence was again denied by a flying Glennon save.
Those stops looked vital in the 21st minute when Andy Preece extended Carlisle's lead.
His 30-yard free kick flew over the bar but the referee ordered the kick to be retaken for encroachment and moved the ball 10 yards forward.
At the second attempt Preece made no mistake, hammering his low drive into the bottom corner from 20 yards.
In a remarkable game Mansfield grabbed a 27th minute lifeline when Gray tripped Lawrence in the area.
United's gamesmanship delayed the spot kick and Cowan was booked for kicking a divot out of the ground by the penalty spot.
But Lawrence eventually netted his 12th penalty of the season, but only after he was ordered to retake his successful first kick.
Another spectacular Glennon save kept out Wayne Corden's 40th minute blockbuster but in the last minute of first half injury time Glennon was beaten again as Lawrence poked in the equaliser from six yards.