Matt Green's injury-time winner took in-form Mansfield into the play-off places for the first time this season with victory at managerless Lincoln.
The Imps were on top before the break but wasted numerous chances, with Alan Power twice missing the target and Vadaine Oliver shooting wide.
An equally lively but more even second period seemed set to end goalless.
But in a frenetic finale, Green won the points with a low finish and Lincoln's Dan Gray was sent for a late tackle.
It was a cruel end to the game for the struggling Imps, who have now won just one game in 12 in the Blue Square Bet Premier.
However, they will take great heart from an impressive display against the division's in-form team and they could easily have had the game wrapped up by half-time.
Power shot wastefully wide after being teed up by Mamadou Fofana and Jake Jones, who on Tuesday signed a loan extension, had a shot blocked after hesitating when well placed.
Lincoln goalkeeper Paul Farman did make an incredible point-blank save to keep out a John Dempster header, but the home side continued to dominate.
Oliver wasted a glorious opportunity when he sidefooted wide from 10 yards following a defensive mix-up, Power blazed a shot over and Oliver was denied by a smart piece of goalkeeping by the on-rushing Alan Marriott.
However the Stags, who had a Green goal disallowed for handball in the closing stages of the first half, looked more solid after the break and the clear-cut chances dried up.
Both sides had numerous long-range efforts and Lincoln's pace and movement continued to pose problems.
At the other end, Matt Rhead's introduction helped the Stags retain possession up front and Dempster forced another fine stop from Farman and a Colin Daniel cross drifted narrowly wide.
But neither side looked like finding a breakthrough until Green's cool finish earned Mansfield an eighth win in nine game and left the 1100 Stags fans celebrating wildly.
Tempers flared in the dying moments with substitute Gray seeing red to complete a miserable evening for the hosts, who are just two points clear of the relegation zone.
Mansfield move up to fourth, five points behind leaders Wrexham with a game in hand.