WREXHAM twice took the lead but fellow strugglers Chesterfield hit back to win 3-2 at the Proact Stadium.
And own goal and Jordan Ponticelli strike put Dean Keates' side ahead in both halves but on both occasions the Spireites equalised four minutes later.
Just when it looked like finishing in a draw, Chesterfield scored the winner deep into added time with virtually the last kick of the game.
The Reds' starting XI showed three changes from the side that started the goalless draw with Dagenham seven days earlier, with Keates switching to a 3-5-2 formation.
New signing Tyler Garratt, brought in on loan from Stockport, came in for injured left-back James Jennings.
Jay Harris and Ponticelli were also handed their first starts since joining Wrexham in January, with Paul Rutherford and Dan Jarvis dropping to the substitutes bench.
Both teams cancelled each other in the opening exchanges but Wrexham began to get on top and Luke Summerfield's low drive in the 16th minute fell narrowly wide.
The Reds took the lead five minutes later.
A quickly-taken Harris free-kick from his own half was headed past ex-Reds goalkeeper Shwan Jalal into his own net by Will Evans who was under pressure from the lively Ponticelli.
Lainton did well to turn Curtis Weston's shot behind at the other end but Chesterfield equalised after 25 minutes.
Josef Yarney's cross was headed on by Weston to Tom Denton who fired past Lainton from close range.
Chesterfield were buoyed by the goal and Nathan Tyler brought a brilliant save out of Lainton who also thwarted Denton from the resulting corner.
Jonathan Smith fired over as Chesterfield's good spell continued but Wrexham went closer when Kieran Kennedy's header from Luke Young's free-kick was tipped over by Jalal.
Wrexham also had another chance just before the break when JJ Hooper broke free and was denied by Jalal who got back into position to save Summerfield's follow-up.
A Harris drive failed to hit the target following a slow start to the second half and Jake Lawlor was denied by Jalal following Young's free-kick but a flag was raised for offside.
Back came Chesterfield and a superb last-ditch block by Shaun Pearson prevented Tyson's shot from troubling Lainton.
However, Wrexham were back ahead in the 68th minute.
Ponticelli raced onto Hooper's through-ball and slotted past Jalal.
But the lead was shortlived once again as Chesterfield levelled four minutes later.
Lainton did not get enough on David Buchanan's corner and Liam Mandeville fired home.
Wrexham responded with Hooper heading just wide from Young's free-kick but Chesterfield saw Evans' header from a corner cleared off the line by Summerfield.
However, the hosts scored the winner in added time when Wrexham failed to clear their lines and Weston's drive went in off the underside of the bar.
Chesterfield (3-4-3: Jalal; Yarney. Evans, Hollis; Cropper, Weston, Smith, Buchanan; Tyson (Boden 82), Fondop, Denton (Mandeville 60). Subs: Fitzsimons, Weir, Hutchinson.
Wrexham (3-5-2): Lainton; Lawlor, Pearson (Rutherford 74), Kennedy; Thompson, Young, Harris, Summerfield, Garratt; Hooper, Ponticelli. Subs: Dibble, Redmond, Jarvis, Keillor-Dunn.
Attendance: 3,728 (637 from Wrexham).
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here