City's third defeat in quick succession and Stockport's first-ever League win at Maine Road came courtesy of Nicky Weaver's wild dash from his goal and a Danny Granville push on Alan Bailey in the ensuing chaos.
The referee John Brandwood awarded the kick after consulting his assistant and Tony Dinning, threatened all night with an old-fashioned roasting by City's left-winger, Mark Kennedy, stepped up to have the last laugh from the penalty spot.
"I thought he was pushed, but I believe it might have been outside the area," said Stockport's delighted manager, Andy Kilner, as his team moved into a play-off position.
Whether the push was inside or outside the penalty area was indeed open to question, but City should never have had to rely on such narrow margins.
Playing with a surprising freedom and confidence after their defeat by Huddersfield and Wolves, they created an abundance of chances in the first- half, notably two headers from their new signing, Robert Taylor, that went wide of the target, a lunging shot by Ian Bishop that hit the bar and one from Granville that shaved the post.
Stockport had shown enough on the break to suggest that they could pose problems of their own, but when City finally took the lead after 49 minutes it seemed that they were at last getting their promotion push back on track.
The goal stemmed from a ball delivered by Kennedy, this time from a corner. Richard Jobson had the first attempt at forcing it in and his fellow defender, Gerard Wiekens, eventually fired into the net.
Stockport's resilience was illustrated by the acrobatic save forced by Bailey immediately afterwards and, in the 65th minute, they were level. Dinning hit a post and the lively Bailey, once a City apprentice, latched on to the rebound to slot it past Weaver.
Eventually it was the increasingly desperate search for a goal to restore their lead that left City fatally exposed at the back. Their manager, Joe Royle, revealed that Weaver had apologised for his blunder after the game. "He made a mistake but he's been magnificent and he'll still play for England," Royle said.
Manchester City (4-4-2): Weaver; Edghill, Wiekens, Jobson, Granville; Whitley (Pollock, 74), Bishop, Horlock, Kennedy; R Taylor (G Taylor, 82), Goater. Substitutes not used: Crooks, Wright (gk), Tiatto.
Stockport County (4-4-2): Nash; Dinning, Flynn, Gallon, Nicholson; Cooper, Woodthorpe, Bennett (Bergersen, 72), Allen; Moore, Bailey (McIntosh, 89). Substitutes not used: Gray (gk), Briggs, Daly.
Referee: J Brandwood (Lichfield).