Sam Dalby’s stoppage-time header secured a dramatic win away to Aldershot Town after a high-scoring encounter at the EBB Stadium.
It looked as though Paul Mullin’s goals were not quite going to be enough, when a late and unfortunate Jordan Tunnicliffe own goal levelled proceedings with just a minute remaining.
But Dalby nodded in Luke Young’s corner to seal victory deep in time added on as Wrexham returned from Hampshire with all three points.
Mullin opened the scoring from the penalty spot and volleyed in a second midway through the first-half, before Oliver Pendlebury pulled a goal back.
A deflected Mullin backheel restored Wrexham’s advantage, but Jake Hutchinson pulled another goal back before half-time.
With both sides missing chances after the break, it looked as though the scoring would be over until a cross deflected in off substitute Jordan Tunnicliffe in the closing minutes to mean a share of the spoils.
Max Cleworth and James Jones – second-half substitutes in mid-week – both returned to the Wrexham starting line-up at the EBB Stadium.
It meant Andy Cannon dropping to the bench, while Harry Lennon missed out with a knee injury – his absence paving the way for fit-again Tunnicliffe to return to the bench.
And the visitors were in front in just the seventh minute, when Mullin’s penalty sneaked under Luca Ashby-Hammond’s body and in after Haji Mnoga stopped Elliot Lee’s shot with his hand.
Aldershot could have responded just two minutes later, when Justin Amaluzor fizzed a cross in and Hutchinson glanced a header wide across goal.
Wrexham created half-chances of their own, as Cleworth’s header from Lee’s cross was saved low on 14 minutes and Lee was provider again when Ollie Palmer’s shot was blocked in the 19th minute.
The second goal on 23 minutes was Wrexham at their very best, however, as Mullin applied the finishing touch to a move that started at the back.
Eoghan O’Connell’s lofted pass was knocked down for Lee by Palmer, who ran at the defence and spread the ball wide to Anthony Forde; the Irishman crossed deep and an unmarked Mullin smashed in his second of the game.
Aldershot hit back on the half-hour, however, when Amaluzor pulled a low ball back into the area and Pendlebury finished low through a crowd.
But Wrexham restored the two-goal lead on 35 minutes. Jones drove at the defence and threaded the ball through to Mullin, whose touch forced him into a backheel which looped in off Corey Jordan.
Again, though, Aldershot responded to half the deficit – this time Hutchinson running onto a long ball over the top and, from an acute angle, firing low through Mark Howard’s legs and in.
Jacob Mendy could have scored a fourth for Wrexham in first-half stoppage time, when Aldershot’s defence failed to deal with Howard’s long ball, but his lob from a difficult angle dropped just wide.
Tunnicliffe replaced O’Connell at half-time, for his first appearance since limping off in the opening stages of the FA Cup Fourth Round match at home to Sheffield United.
He was in the thick of the action immediately too, making a good tackle on the edge of the box before Ryan Glover shot straight at Mark Howard on 47 minutes.
Amaluzor then went close on 57 minutes, running at Jones and eventually digging out a left-footed shot that dropped just over.
At the other end, Ashby-Hammond had to be out quickly on 59 minutes to beat Palmer to a lofted ball over the top.
Liam McAlinden replaced Jacob Mendy on 63 minutes, and the substitute had to hook a header over his own bar two minutes later from an Aldershot corner.
Jordan then headed over the bar from Ollie Harfield’s free-kick in the 67th minute as the Shots’ pressure continued to mount.
An excellent Cleworth tackle set up a counter-attack on 72 minutes, as Palmer played Mullin in behind the defence, but Ashby-Hammond stretched out a left leg to save. From the resultant Luke Young corner, Tunnicliffe headed just over the bar.
And on 74 minutes, Lee played Mullin in on his right-foot, but the striker was just off balance as he fired his right-footed shot over.
Young then picked Lee out at the back post with a deep corner on 78 minutes, but his header was just over.
Lee went close again in the 81st minute, working the ball onto his right-foot and shooting low, but Ashby-Hammond saved and the ball was cleared behind for a corner.
But Aldershot took full advantage of their reprieves when, with just a minute remaining, a cross hit the unfortunate Tunnicliffe and crept past the wrong-footed Howard.
This Wrexham team never says die, however, and - after a delay while Mnoga received treatment for a head injury - Dalby rose highest to head Young's inswinging corner in across goal.
Aldershot Town: Ashby-Hammond, Mnoga, Partington, Jordan, Cordner, Harfield, Klass (Frost 60), Amaluzor, Glover, Hutchinson (Willard 90+1)
Subs: Anderson, Ochieng, Roberts
Wrexham: Howard, Cleworth, Tozer, O’Connell (Tunnicliffe 46), Forde, Young, J.Jones, Mendy (McAlinden 63), Lee, Mullin (Dalby 85), Palmer
Subs: Lainton, Cannon
Referee: Sam Mulhall
Attendance: 4,568 (1,142 away)
Aldershot: Mnoga (6, handball)