Two goals in the space of two minutes looked to have salvaged Macclesfield Town a hard-fought point at Accrington but Roscoe D'Sane's second goal of the match made sure John Coleman's battling side snatched all three points.
It was only Accrington's third home win of the season in League Two.
D'Sane found the back of the net with a sweet 51st minute strike, before Paul Mullin doubled the home side's advantage just three minutes later.
And it was nearly 3-0 as John Miles was only denied by a good save from Macc keeper Tommy Lee.
However, having survived sustained pressure, the visitors took full advantage of a 71st penalty to haul themselves back into the contest.
Graham Branch felled Francis Green in the box and Kevin McIntyre didn't waste the chance to reduce his side's arrears.
And it got even better for the visitors when, just two minutes later, Gareth Evans beat Stanley keeper Ian Dunbavin with a powerful header.
However, within a minute the Silkmen were hit with a sucker-punch as D'Sane headed the home side into the lead again.
That was the way it stayed with five goals scored within the space of 23 frantic second-half minutes.
Both sides were guilty of wasting good chances in the first half, even D'Sane who fired wide in the fifth minute.
Green had a shot saved by Dunbavin, while at the other end Peter Cavanagh hit the target and Mullin fired over.
Levi Reid went close for Macc and Danny Thomas also fired wide. Robbie Williams forced Lee to make a smart stop shortly after the half-hour mark, before Mullin headed over.
But it was a crazy second-half spell which saw Stanley grab their second win on the bounce having beaten Dagenham and Redbridge 3-1 last weekend.