Stockport battled back from 4-2 behind to win their LDV Vans Trophy second round clash in extra-time.
Owen Morrison and promising striker Chris Williams grabbed the important goals in the 72nd and 78th minutes respectively, to force the additional period as Sammy McIlroy's team pushed for their first win at Edgeley Park since Easter Monday.
Earlier, Mark Jones had given the visitors a ninth-minute lead, before Stuart Barlow equalised in the 21st minute and Rickie Lambert scored a cracker in the 39th minute to put the Hatters in front.
However, County's joy was short lived as Shaun Holmes equalised before half time, before Hector Sam and Chris Armstrong seemed to have put Wrexham into an unassailable lead early in the second half.
However, Morrison's and Williams' goals made sure the match went into extra time.
Jim Goodwin then capped a memorable comeback from Stockport with the silver goal that made sure the home side triumphed at home for the first time since Easter Monday.
The Republic of Ireland Under-21 international coolly slotted home from the penalty spot in the 96th minute after Craig Morgan had bundled over Williams in the box.