Substitute Jordy Hiwula grabbed a 90th-minute winner as Wigan Athletic scored three goals in the final nine minutes to fight back from 2-0 down and beat Chesterfield in a compelling match.
Dan Gardner's fabulous 30-yard strike put the Spireites ahead and Leon Barnett's own goal put them in control.
But Barnett's fine low shot and a Craig Davies penalty levelled things.
And, as the Wigan pressure grew, Hiwula stole the points when he scored with a coolly-taken right-foot strike.
The victory, which puts Wigan level with their hosts on 10 points, looked a near impossibility as the hosts seized control after a goalless first half.
The Latics were on top before the interval but trailed when Gardner cut in from the left flank and crashed a superb shot high into the net.
Barnett's bizarre headed own goal looked like deciding the match, but he made amends when he netted at the right end on 81 minutes.
And, after Davies scored from the spot following Sam Hird's foul on Chris McCann, Hiwula's strike ensured a first away league win of the season for Wigan.