Cedwyn Scott saw an injury-time penalty saved as we slipped to defeat in north Wales.
The substitute saw his spotkick saved by Ben Foster with virtually the last kick of the game as we were denied a point in a frantic affair.
John Bostock had given us the lead with a stunning free-kick, only for Paul Mullin to equalise shortly after the break.
The hosts then went in front through Jacob Mendy, only for Kyle Cameron to equalise.
But, after Elliot Lee restored his side's lead, we couldn't find a telling response despite being handed a spotkick right at the death.
Sam Slocombe returned from injury and took his place behind a back three of Cameron, Geraldo Bajrami and Wrexham-born Connell Rawlinson.
Adam Chicksen and Aaron Nemane took up their usual wing back positions, with Matt Palmer, Jim O’Brien, Bostock and Ruben Rodrigues lining up behind Macaulay Langstaff.
Williams had plenty of attacking options on the bench, with Cedwyn Scott, Sam Austin, Jodi Jones and Frank Vincent waiting in the wings with Tiernan Brooks.
Following an emotional minute’s applause for our late CEO Jason Turner, the opening exchanges proved cagey with Wrexham struggling to penetrate our high line, while we found it difficult to make our possession count.
The near 10,000-strong crowd were in incredible voice but had to wait until the 29th minute for the game’s first big moment as Mullin went down under an apparent challenge from Slocombe as the pair competed for a ball over the top of our defence. The referee waved play on – but didn’t book the forward for simulation.
We responded with the game’s first meaningful shot, Ben Foster pushing Cameron’s low, curling effort wide, shorly before the keeper had to race off his line to deal with Bajrami’s lofted ball into his area. Foster wiped out Rodrigues and his own defender, with the ball running behind.
Shortly after Rawlinson had seen yellow for blocking off his man, Mullin did write his name into the referee’s notebook for a lunging challenge on Rodrigues.
And another foul, this time from James Jones, would lead to one of our goals of the season as John Bostock curled a stunner into the top corner from 25 yards to send the away end into delirium on the stroke of half-time.
Our resistance was broken quickly shortly after the restart, however, as our hosts exploited space down the right to cross the ball low into the middle. Mullin appeared to knock Bajrami to the ground as he ran across him but no foul was given, leaving the front man to produce an excellent first-time finish beyond Slocombe.
We nearly went behind shortly after the hour as Eoghan O’Connell rattled the crossbar with a well-struck volley.
But Slocombe was beaten again eight minutes later as our hosts again burst away down the right, this time crossing for Mendy to produce an emphatic finish.
With the Racecourse rocking we were up against it – but showed excellent composure to reassert our influence on the game.
Foster got an important hand to Cameron’s cross-shot before producing an outstanding one-handed save to deny Austin, who had danced his way into the area and rocketed an effort towards the top corner shortly after replacing O’Brien.
But, from the resultant corner, Cameron was left unmarked and the big defender dived in to head Palmer’s dinked cross home for the equaliser.
It was now all to play for and Williams made a further two changes, introducing Jones and Scott for Nemane and Rodrigues.
But, two minutes later, we were dealt a killer blow as again we allowed our hosts to escape down the right, with Bajrami unable to deal with the low cross. Mullin slid the ball to Lee for a straightforward finish.
We couldn’t find a quick response and had Slocombe to thank for a big save shortly before six added minutes were signalled, during which Cameron failed to make contact on a low cross with a right-footed effort eight yards out.
But a lifeline was to come as, in the dying seconds, a Wrexham man was adjudged to have handled a high ball in the box.
Scott took responsibility for the penalty, having to re-spot the ball as wind and tension swirled around the ground in equal measure.
But, despite striking his effort well, Foster dived to his right to make another excellent save and put his side well and truly in the driving seat at the end of the hottest title race in National League history.
NOTTS STARTING XI: Slocombe; Cameron, Bajrami, Rawlinson; Chicksen, Nemane (Jones 76’); O’Brien (Austin 69’), Palmer, Bostock, Rodrigues (Scott 77’); Langstaff
UNUSED SUBS: Brooks, Vincent
BOOKINGS: Rawlinson 40', Palmer 66'
ATTENDANCE: 9.924 (1,042)