Rob Street held his nerve to seal all three points for the Imps in a performance of real resilience and grit at Stockport County.
City looked to have to settle for a point after Jayden Fevrier levelled Reeco Hackett's opener, but when the visitors were awarded a penalty in time added on at the end of the second half it was Street who calmly slotted the ball home to claim victory.
Michael Skubala named an unchanged side from the team that defeated league leaders Cardiff City last Saturday.
And, with confidence high, it was no surprise the Imps started well - with Hackett seeing a shot blocked, following a long throw from Tom Hamer, inside the opening minute.
There were plenty of signs of positive intent in the opening period, with Jack Moylan almost sending Hackett through again after five minutes and Freddie Draper squeezed out two minutes later.
Ben Hinchliffe, the home goalkeeper, was quickly out of his area to intercept a ball for Moylan after the energetic Irishman threatened.
After surviving the early pressure, the hosts' first half chance came after 17 minutes when Kyle Wootton tried a flicked header from Oliver Norwood's ball. He did not do enough to get that effort on target.
Jack Diamond, who had a previous loan spell with the Imps, saw an effort clip the outstretched leg of Adam Reach before going wide. Tyler Onyango won the header from the resulting corner, but again the ball flashed wide without testing George Wickens.
Wooton again did well to get a low shot away after 27 minutes despite pressure from Hamer, the first time Wickens was forced into a save,
But the Imps responded perfectly to that by going upfield and opening the scoring. Moylan did well before feeding Street in a central position - he held off two players before finding the run of Hackett from the right. He also had the attention of several Hatters players, but his strong low shot was too powerful for Hinchcliffe who got a hand to it but could not prevent the ball landing in the back of the net.
City had their tails up and Reach got away down the left after winning the ball back himself. That move led to a Moylan shot which was blocked, with Conor McGrandles unable to keep his effort from the rebound down.
Hackett rattled the crossbar direct from a corner - after Ethan Pye had blocked a Tom Bayliss effort with his head - and Hinchliffe was not severely tested with a low effort from Hackett as he got down and got his body behind the ball.
Hinchliffe had to get a strong hand to a Moylan effort in one of the final bits of action before the break, again after another good move involving Reach down the left. Pye got a vital clearance in as Hackett rushed in looking for his second goal of the game.
The Imps were forced into once change at the break as Tom Bayliss had to be withdrawn after a knock suffered in a challenge with Diamond late in the second period, with Ivan Varfolomeev coming on in his place.
City started the second period with confidence, with Tendayi Darikwa seeing a shot deflected off Pye before looping into the arms of a grateful Hinchliffe.
The Imps faced the greatest danger of the match after 50 minutes, after conceding a central free-kick just outside the area. Norwood's effort bypassed the wall but a diving Wickens was equal to it as he got two strong hands to turn the ball away.
The threat was only temporarily averted, as once the home side got the ball back into the area from the resulting throw-in they were awarded a penalty.
Again Wickens was equal to Norwood, as he dived to his right to stop the set-piece, but the ball bounced back and Fevrier - who had replaced Onyango just moments earlier - was on hand to turn the ball home and draw the home side level.
City had to regroup and work their way back into the game, with Hackett and Draper seeing efforts blocked as they did so.
They enjoyed a good spell of possession and created a number of chances from winning the ball back in the opposition's half. Reach was particularly effective at breaking down the left, creating an opportunity for Street which was blocked behind for a corner after 71 minutes.
That set-piece led to another Moylan effort, deflected behind for another corner. The third delivery was cleared, but when the ball was played back in Draper did well to spin away from his man and get a shot away which flashed wide.
City did hit the woodwork after 76 minutes, and again it was no surprise that the move started with the visitors winning the ball back on the left. This time Dom Jefferies, who by now had replaced Draper, sent in a deep cross which was met by the head of Street who then watched as the ball clipped the post and bounced wide.
Neither side were happy to settle for a point in an enthralling finish to the game.
Wickens did well to stop Diamond's effort with 10 minutes to go and, after 84 minutes, a left-footed inswinging deliver from Hackett almost found the outstretched left foot of Jefferies.
Late probing from the Imps proved decisive. Hills got in a vital clearance as Hackett's cross from the left tried to find Obikwu, but moments later Hackett was brought down in the area by Hunt for the awarding of the decisive spot-kick.
Street stood up and calmly finished into the bottom right corner of the goal, leaving Hinchliffe with no chance.
City saw out the remaining couple of minutes, with Sonny Bradley particularly influential with three big headers as the home side threw the ball into the area.
Stockport County: Hinchcliffe, Dodgson, Olowu, Diamond, Lowe, Pye, Wooton, Osborn, Onyango, Norwood, Hills. Subs not used: Addai, Fevrier, Motherseille, Edun, Bailey, Hunt, Gardner.
Imps: Wickens, Darikwa, Reach, Hackett, Bayliss (Varfolomeev, 46), Moylan (Obikwu, 88) McGrandles, Bradley, Street (Towler, 90+3), Hamer, Draper (Jefferies, 74). Subs not used: Jeacock, Ring, Okoronkwo.
Referee: Paul Marsden
Attendance: 9,690 (631 away).