Spireites came from behind for their first win of the season to maintain their hopes of retaining the Johnstone’s Paint Trophy.
Oldham striker Matt Smith scored in the first half before heading in a last-gasp own goal to put Chesterfield through.
Danny Whitaker had equalised and then saw a penalty saved, but his blushes were spared by the late mistake.
Early exchanges were low-key, only a Christian Montano effort in the second minute going close before the visitors snatched the lead.
Lee Croft, borrowed from Derby, delivered a right-wing cross for Smith to head downwards and beat Tommy Lee.
Spireites had a great opportunity when the ball fell to Richards after a defensive mix-up, but he delayed shooting and a foot got in to clear.
At the start of the second half, Spireites were presented with a gift. James Tarkowski erred just outside the box and former Latic Whitaker pounced, made ground and coolly slotted home. The scorer had a blue-chip chance to put his side ahead on 62 minutes. Richards was upended in the box by ex-Spireite Jonathan Grounds but Whitaker saw Bouzanis palm away the spot kick.
Eighteen-year-old Jacob Hazel came on to make it a rare father-son combination for the club; Dad Des, also a former Miller and Owl, played for Chesterfield in the mid-90s.
The hosts needed the bar to save them late on when sub Connor Hughes hammered a long-ranger just before Richard O’Donnell had to come on for his debut following an injury to Lee. Seconds later, Talbot’s cross teased out the own goal to send Chesterfield into round two.
Chesterfield: Lee 6 (O’Donnell 88), Forbes 7, Trotman 6, Hird 7, Ridehalgh 6, Talbot 7, Randall 7 (Clay 90+4), Togwell 8, Whitaker 7, Boden 6 (Hazel 65, 6), Richards 6. Subs (not used): Darikwa, Lester.
Goals: Whitaker 48, Smith (og) 90+1.
Oldham: Bouzanis 6, Byrne 7, M’Voto 6, Tarkovski 6, Grounds 6, Croft 7 (Millar 71), M’Changama 6, Winchester 6 (Mellor 71), Montano 7, Simpson 6 (Hughes 65, 6), Smith 6. Subs (not used): Cisak, Taylor.
Goal: Smith 23.
Bookings: Tarkowski, Montano (Oldham).
Ref: Tony Harrington (Cleveland).