Tranmere Rovers extended their unbeaten run to 15 games - a new club record - but missed the play-offs by a whisker.
The Rovers came back from two goals down to snatch victory and leave manager Ray Mathias pleased with the win, but frustrated by the consequences: "I am delighted to have reached 80 points this season," he said. "But in the last few years, that would have got us into the play-offs." County had looked in total control and deservedly led 2-0 at the break.
The visitors were made to look sloppy and heavy-legged as County forced them onto the back foot with attacking football.
The pressure told on eight minutes. Ali Gibb's cross from the right flank found Aaron Wilbraham arriving on cue to beat Tranmere's Dutch keeper John Achterberg with a cool finish inside the far post. It was Wilbraham's seventh goal in six games.
Midway through the half, Stockport underlined their superiority when Andrew Welsh side-stepped the advancing keeper to score the second. It could have been three, but the woodwork denied Gibb.
But a penalty in the first minute of the second half changed the game.
Jason Price, a second half substitute for Iain Hume, chased a long ball forward, got himself goalside of the home defence and was up-ended by County's advancing keeper Ola Tidman.
Referee Mr Salisbury pointed to the penalty spot, yellow-carded Tidman, and Shane Nicholson scored from the spot.
It was County's turn to feel the pressure and on 71 minutes Simon Haworth equalised and nine minutes from time Gary Jones headed Tranmere in front from a corner.
After the match Rovers boss Mathias revealed that at half-time, he said to his players, "You can go out and get humiliated if you want to. I don't want to be humiliated. And I got the perfect result from the lads".