The Gulls thought they had clinched the points 12 minutes from time when Jamie Reid's cross was bundled in at the far post by Ruari Keating.
However, the Imps equalised in the 86th minute when a shot from Adam Marriott was parried by Brendan Moore only for substitute Harry Anderson to score from the rebound.
The home side then secured their fifth successive victory two minutes later when Sam Habergham fired a free-kick into the top corner.
Lincoln dominated the first half and Gulls keeper Brendan Moore had to be on his toes twice to deny Jack Muldoon, although at the other end Paul Farman made a brilliant save to keep out a corner at the near post.
Match report supplied by the Press Association.
Match ends, Lincoln City 2, Torquay United 1.
Second Half ends, Lincoln City 2, Torquay United 1.
Substitution, Torquay United. Brett Williams replaces Myles Anderson.
Substitution, Torquay United. Shaun Harrad replaces Ruairi Keating.
Goal!  Lincoln City 2, Torquay United 1. Sam Habergham (Lincoln City).
Goal!  Lincoln City 1, Torquay United 1. Harry Anderson (Lincoln City).
Substitution, Torquay United. Ben Gerring replaces Damon Lathrope.
Goal!  Lincoln City 0, Torquay United 1. Ruairi Keating (Torquay United).
Harry Anderson (Lincoln City) is shown the yellow card.
Substitution, Lincoln City. Adam Marriott replaces Jack Muldoon.
Substitution, Lincoln City. Harry Anderson replaces Josh Ginnelly.
Substitution, Lincoln City. Elliot Whitehouse replaces Billy Knott.
Second Half begins Lincoln City 0, Torquay United 0.
First Half ends, Lincoln City 0, Torquay United 0.
Ruairi Keating (Torquay United) is shown the yellow card.
Shaun Harrad (Torquay United) is shown the yellow card.
Myles Anderson (Torquay United) is shown the yellow card.
First Half begins.
Lineups are announced and players are warming up.
Lincoln scored twice in the final five minutes to secure a 2-1 win against relegation-threatened Torquay and move five points clear at the top of the National League table.