FLASHBACK: Ainsworth inspires Hereford
The ex-England U-19 international was certainly man-of-the-match but Hereford had to work solidly as a team to counteract a Stockport side who refused to give up.
Indeed, the Hatters went close to grabbing a point on several occasions but in the end United held firm.
Bulls boss Graham Turner was delighted by United's inventiveness up front.
'When we had the ball we looked a decent side. We attacked very well. We had chances and we took three of them.
'We didn't have too many problems when Stockport were playing with their front three big lads but when they changed and went with two wide players they caused us a few problems.
'Perhaps we rode our luck a little bit for a spell, but I thought we should have scored more than three goals.'
There was little hint of the excitement to come in a patchy and cagey opening, although debutant Lee Collins caught the eye with several timely tackles.
County strikers Liam Dickinson and Adam Proudlock failed to beat Brown as the match eventually came to life, but it was the ever eager Ainsworth who was to come up trumps.
Ainsworth put the Bulls ahead in the 37th minute with a delightful run and chip over Logan in the home goal, and ten minutes after the restart he doubled United's advantage, popping up at the far post to nod home Theo Robinson's hanging cross from the left.
But back came Stockport and after Liam Dickinson was felled in the box on the hour mark Anthony Elding confidently fired home the penalty to give County a lifeline.
United withstood constant home pressure for the next ten minutes or so, but remained a threat on the counter, and so it proved when Ainsworth outpaced a somewhat static home defence to make it 3-1 to the Bulls midway through the half.
However, rather than throwing in the towel, Stockport upped the tempo still further and from one of a succession of Michael Rose corners Wayne Brown punched the ball into his own net with eight minutes left to produce a grandstand finish.
The Bulls resilience and discipline shone through in the end though, and overall United's performance thoroughly deserved the three points.
For County, manager Jim Gannon was forced to endure some barracking from certain sections of the home crowd, but he recognised United`s predatory instincts.
'We had our chances and didn't take them, but they took theirs.'
'And the third goal was a killer for us because it meant that we really had to go for it.
'We worked really hard to get back in the game, and we might have had a second penalty.
'It was disappointing not to come away with something.'
As a result of this victory United secured a stronger grip on an automatic promotion spot, and now stand five points clear of 8th placed Wycombe who are chasing the last play-off place.
Final Score: Stockport County 2 - 3 Hereford United
Goalscorers: Stockport - Elding (pen), Brown o.g.- Hereford - Ainsworth (3)
Stockport County (4-4-2): Logan, Bowler (Tansley 75 min), McNeil, Rose, Elding, Nowland, Taylor, Griffin (Poole 72 min), Proudlock (Rowe 72 min), Dickinson. Substitutes not used: Tunnicliffe, Turnbull.
Hereford United (4-4-2): Brown, Collins, Rose, McCombe, Threlfall, Ainsworth, Smith, Diagouraga, Easton, Benjamin (Guinan 79 min), Robinson (Webb 84 min). Substitutes not used: Ingham, Beckwith, Taylor.
Referee: David Foster (Newcastle, Tyne & Wear).
Attendance: 5,103 (260 from Hereford)
Star Player: Lionel Ainsworth