The impressive Sullay Kaikai opened the scoring for the U’s in just the third minute when his speculative 35-yard free-kick flew over the wall and evaded the dive of Stags’ custodian Sascha Studer.
Kaikai scored again just moments prior to half-time, before the Stags pulled a goal back in the second half when Jack Thomas pounced on a mistake by Josh Coulson and squared the ball to Rakish Bingham, who slotted into an empty net.
However, Cambridge secured their first home win in three months with two minutes to go as Tom Elliott headed into an empty net following a left-wing cross by Harrison Dunk.
Results elsewhere, nevertheless, mean that Adam Murray’s team are mathematically safe from relegation with two games of the season left to play.
The match got off to a frantic start and some exciting link-up play from Kaikai and striker Jordan Slew in the final third caused trouble for the Stags.
The U’s broke the deadlock in the 3rd minute after Kaikai converted his free-kick from 30 yards out, evading the grasp of goalkeeper Sascha Studer in the process, following a foul by Ricky Ravenhill.
Richard Money’s men were forced into an early substitution when Greg Taylor made his entrance replacing midfielder Ryan Donaldson, who was unable to recover after suffering what looked like a hamstring injury.
A good spell of possession greeted the home side as the Stags’ defence continued to be called into action. Having already scored once from the dead ball, Kaikai’s ambitious long-range effort from another free-kick in the 13th minute sailed just wide of Studer’s left post.
Cambridge maintained their stranglehold as the match neared the 20-minute mark. Winger Junior Brown looked to unlock the defence with a chipped through ball that couldn’t quite find its way through to striker Vadaine Oliver.
The visitors looked to breach the defence again in the 27th minute when midfielder Jack Thomas won the ball off midfielder Harrison Dunk, who thought he was fouled. His attempted through ball was placed too far in front of Oliver and was claimed comfortably by ‘keeper Chris Dunn.
Thomas found his way into referee Kevin Wright’s notebook after he was shown the yellow card after a late foul on Dominic Ball.
Adam Murray’s men threatened again on 30 minutes when Oliver did well to hold onto possession on the by-line. He attempted to play in the advancing Thomas, but Dunn was present to clean up the scraps.
Another nervous moment presented itself with five minutes remaining in the first half when Tom Champion won the ball off Ravenhill in the heart of midfield. Slew’s long-range snap-shot took a bobble, but was comfortably claimed by Studer.
The U’s then doubled their advantage in the 42nd minute after a short corner from Ball found Kaikai on the edge of the penalty area. The winger took a shot from 20-yards out with his left foot and found the back of the net, despite Studer getting fingertips to the ball.
In response to being two goals down, Murray made two changes at the beginning of the second half with Matt Rhead and Rakish Bingham coming on in place of Oliver and Terry Hawkridge as the Stags attacked towards the away end.
A well-timed tackle from Ravenhill on the edge of the penalty area in the 50th minute prevented Slew from firing his shot towards goal.
In the 54th minute, Kaikai was confident of completing a hat-trick when he stepped up to take a free-kick on the edge of the box, only to send his shot straight into the arms of Studer.
Striker Ryan Bird, who returned to the side after being left out of the squad in recent matches, replaced Slew on the hour-mark.
The U’s came close almost straight after the substitution when Elliott headed Kaikai’s pin-point cross just wide of the right-hand post.
Young midfielder Joe Fitzpatrick then came on for his second senior appearance as he replaced Ravenhill in the 63rd minute.
The Stags found a life-line just a minute later after an under-hit back pass from Josh Coulson was seized on by Thomas who played a simple ball from the right side across the penalty area into the path of substitute Bingham, who tapped the ball into the back of the net.
With 15 minutes remaining in the match, midfielder Clements was cautioned for a late challenge after the referee played a good advantage that saw U’s star man Kaikai break through the middle of the park with pace, only to be denied by the Stags’ defence.
Studer’s long clearance in the 83rd minute allowed Bingham to produce a delightful flick-on to find Rhead who fired his shot over the crossbar.
Moments later Elliott found the ball at his feet as Cambridge went on another attack to try and seal their victory. The resulting shot from distance stung the palms of Studer of stood tall to collect.
Cambridge sealed their win on 88 minutes when Elliott passed the ball to Dunk, who weaved his way through the defence and managed to pick out the unmarked Elliott who headed the ball past Studer from six yards.
Attendance: 4,667 (274 away supporters).