The League One outfit looked set for a comfortable passage after dominating the opening hour and building a 2-0 lead.
But Lincoln came fighting back to force extra time and then take the lead in the first period in a real topsy-turvy affair.
Striker Steve Torpey fired Scunthorpe in front from close range after just eight minutes.
He then limped off through injury midway through the opening half to be replaced by Shane Paul, a former Aston Villa youngster who was making his debut.
Scunthorpe also gave a first appearance to former Liverpool winger Robbie Foy who almost got on the scoresheet with a cracking early shot.
Striker Billy Sharp was a threat throughout to the Lincoln defence, twice forcing excellent saves from goalkeeper Simon Rayner.
It was not until the 58th minute that the home side increased their lead when midfield man David Mulligan scored direct from a free-kick on the edge of the box.
Lincoln's hopes appeared to be sunk but striker Mark Stallard gave them some hope when he reduced the arrears in the 69th minute from a cross by Ryan Amoo.
And 12 minutes later a long throw into the box by Amoo was only half-cleared to midfield man Scott Kerr who rifled home an equaliser from 20 yards.
Three minutes into extra time Lincoln went in front when defender Lee Beevers squeezed a header past goalkeeper Joe Murphy and into the net off the side of a post following a free-kick from Paul Morgan.
Now it was Scunthorpe who looked dead and buried until a terrific fightback in the second half of extra time.
Paul started it when he fired home from close range to make it 3-3 in the 109th minute from a low cross by Richard Hinds.
And two minutes later midfield man Ian Baraclough cracked home a winner from just inside the box giving Rayner no chance.
It enabled Scunthorpe to squeeze through to round two in a pulsating game they should have had wrapped up in the early stages.
But Lincoln came fighting back to force extra time and then take the lead in the first period in a real topsy-turvy affair.
Striker Steve Torpey fired Scunthorpe in front from close range after just eight minutes.
He then limped off through injury midway through the opening half to be replaced by Shane Paul, a former Aston Villa youngster who was making his debut.
Scunthorpe also gave a first appearance to former Liverpool winger Robbie Foy who almost got on the scoresheet with a cracking early shot.
Striker Billy Sharp was a threat throughout to the Lincoln defence, twice forcing excellent saves from goalkeeper Simon Rayner.
It was not until the 58th minute that the home side increased their lead when midfield man David Mulligan scored direct from a free-kick on the edge of the box.
Lincoln's hopes appeared to be sunk but striker Mark Stallard gave them some hope when he reduced the arrears in the 69th minute from a cross by Ryan Amoo.
And 12 minutes later a long throw into the box by Amoo was only half-cleared to midfield man Scott Kerr who rifled home an equaliser from 20 yards.
Three minutes into extra time Lincoln went in front when defender Lee Beevers squeezed a header past goalkeeper Joe Murphy and into the net off the side of a post following a free-kick from Paul Morgan.
Now it was Scunthorpe who looked dead and buried until a terrific fightback in the second half of extra time.
Paul started it when he fired home from close range to make it 3-3 in the 109th minute from a low cross by Richard Hinds.
And two minutes later midfield man Ian Baraclough cracked home a winner from just inside the box giving Rayner no chance.
It enabled Scunthorpe to squeeze through to round two in a pulsating game they should have had wrapped up in the early stages.