text: Media playback is not supported on this device
  The Imps, who have not lost since 24 September, took the lead through Theo Robinson's close-range header.
  Terry Hawkridge slotted in the second shortly after, and Robinson chipped in to make it 3-0 after the break.
  Peter Clarke and Billy McKay scored to give Oldham hope, but they could not find a late equaliser.
  Cameron Burgess came closest to levelling the scores, planting a free header wide of the target.
  Lincoln, who are second in the National League, will now face a trip to Championship side Ipswich in the third round, which takes place on 6-9 January 2017.
  They last made it to the last 64 in the 2009-10 season, losing 4-0 to Bolton, then of the Premier League.
  Two-goal hero Robinson, released by Port Vale at the end of last season, had been a free agent until 8 October, when Lincoln boss Danny Cowley signed him on a short-term contract.
  Oldham, who are 23rd in League One, have now failed to win in five matches in all competitions.
  Media playback is not supported on this device
  Lincoln manager Danny Cowley paid tribute to the club's fans after the game, saying the 7,012 supporters in the ground "carried" his side to the win after conceding two quick goals.
  "For us to have over 7,000, it's beyond all of our wildest expectations," he told BBC Radio Lincolnshire.
  "I think credit goes to the players, because they've got people in the city believing again
  "We said it in the dressing room that they might have League One players, but we've got Premier League people.
  "We've got proper people, proper characters and they dug in when it really mattered."
  Match ends, Lincoln City 3, Oldham Athletic 2.
  Second Half ends, Lincoln City 3, Oldham Athletic 2.
  Foul by Peter Clarke (Oldham Athletic).
  Bradley Wood (Lincoln City) wins a free kick in the defensive half.
  Harry Anderson (Lincoln City) is shown the yellow card for a bad foul.
  Cameron Burgess (Oldham Athletic) wins a free kick in the defensive half.
  Foul by Harry Anderson (Lincoln City).
  Oliver Banks (Oldham Athletic) is shown the yellow card for a bad foul.
  Attempt missed. Oliver Banks (Oldham Athletic) right footed shot from outside the box misses to the left.
  Attempt blocked. Oliver Banks (Oldham Athletic) right footed shot from outside the box is blocked. Assisted by Ryan McLaughlin.
  Lee Erwin (Oldham Athletic) is shown the yellow card for a bad foul.
  Foul by Lee Erwin (Oldham Athletic).
  Harry Anderson (Lincoln City) wins a free kick on the right wing.
  Foul by Oliver Banks (Oldham Athletic).
  Jack Muldoon (Lincoln City) wins a free kick on the left wing.
  Substitution, Lincoln City. Jack Muldoon replaces Theo Robinson because of an injury.
  Substitution, Oldham Athletic. Darius Osei replaces Freddie Ladapo.
  Attempt missed. Cameron Burgess (Oldham Athletic) header from the centre of the box misses to the right. Assisted by Oliver Banks with a cross following a corner.
  Corner,  Oldham Athletic. Conceded by Sam Habergham.
  Attempt missed. Freddie Ladapo (Oldham Athletic) header from the left side of the six yard box is high and wide to the right. Assisted by Oliver Banks with a cross following a corner.
  Corner,  Oldham Athletic. Conceded by Bradley Wood.
  Attempt saved. Lee Croft (Oldham Athletic) right footed shot from outside the box is saved in the centre of the goal. Assisted by Cameron Dummigan.
  Goal!  Lincoln City 3, Oldham Athletic 2. Billy McKay (Oldham Athletic) left footed shot from the left side of the six yard box to the bottom right corner. Assisted by Lee Erwin.
  Substitution, Lincoln City. Harry Anderson replaces Terry Hawkridge.
  Attempt missed. Paul Green (Oldham Athletic) right footed shot from outside the box misses to the left.
  Goal!  Lincoln City 3, Oldham Athletic 1. Peter Clarke (Oldham Athletic) header from the centre of the box to the bottom left corner. Assisted by Oliver Banks with a cross following a corner.
  Corner,  Oldham Athletic. Conceded by Matt Rhead.
  Ryan McLaughlin (Oldham Athletic) wins a free kick on the left wing.
  Foul by Nathan Arnold (Lincoln City).
  Delay over. They are ready to continue.
  Delay in match Paul Farman (Lincoln City) because of an injury.
  Substitution, Oldham Athletic. Billy McKay replaces Jamie Reckord.
  Lee Erwin (Oldham Athletic) wins a free kick in the attacking half.
  Foul by Alan Power (Lincoln City).
  Corner,  Oldham Athletic. Conceded by Paul Farman.
  Attempt saved. Lee Erwin (Oldham Athletic) right footed shot from outside the box is saved in the top right corner. Assisted by Jamie Reckord.
  Offside, Lincoln City. Matt Rhead tries a through ball, but Theo Robinson is caught offside.
  Foul by Peter Clarke (Oldham Athletic).
  Alex Woodyard (Lincoln City) wins a free kick in the defensive half.
  Attempt saved. Matt Rhead (Lincoln City) left footed shot from outside the box is saved in the top centre of the goal.
target: National League side Lincoln held on to shock League One strugglers Oldham and reach the third round of the FA Cup for the first time since 2010.