Famara Diedhou scored the winning penalty as Epinal, struggling in the drop zone of France's third tier, won the shoot-out 4-2, with the match having finished 3-3 after extra-time.
Epinal stunned the visitors as Tristan Boubaya scored in the 10th and 13th minutes to power them into a 2-0 lead, although Lyon were level by the 20th minute as Bafetimbi Gomis and Gueida Fofana replied in a thrilling start to the match.
Lisandro Lopez fired Lyon ahead from the penalty spot soon after the hour mark after Valentin Focki handled, but Focki made amends with a 75th-minute equaliser that sent the game to extra-time.
The 30 minutes passed without further goals, but misses from Fofana and Sidy Kone in the shoot-out cost Lyon the chance to progress.
Marseille, level with Lyon and Paris St Germain at the top of the league table, needed an extra-time winner from Andre-Pierre Gignac to sneak past Ligue 2 side Guingamp with a 2-1 win at the Velodrome.
Gignac had given L'OM a 23rd-minute leader but they could not add to their advantage before Christophe Mandanne levelled seven minutes from time. That forced the extra period which Marseille edged when Gignac struck his second of the afternoon in the 107th minute.
Nice needed extra-time to beat Metz 3-2 away from home, despite the hosts playing from the 22nd minute with only 10 men following the dismissal of Gregory Proment.
Proment was somewhat harshly dismissed for a foul on Didier Digard after 22 minutes and Nice soon took advantage with Neal Maupay firing home. But they failed to take advantage and Yeni N'Gbakoto levelled early in the second half, sending the game to extra time.
Valentin Eysseric struck twice in the 98th and 107th minutes to put Nice in control, and Thibaut Bourgeois' 114th-minute effort was in vain.
Ligue 2's Lens knocked out top-flight Rennes 2-1 courtesy of a late own goal from Kevin Theophile-Catherine. Just six minutes after Julien Feret had cancelled out Jerome Le Moigne's first-half opener, Theophile-Catherine put through his own net in the 87th minute.
Bordeaux needed an injury-time winner from Brazilian defender Mariano to top Ligue 2's Chateauroux 3-2 away from home, despite the hosts playing with 10 men for most of the second half.
Fahid Ben Khalfallah put Bordeaux ahead before the half-hour mark, but Chateauroux shrugged off the dismissal of Elie Ehua early in the second half to snatch the lead through Claudio Beauvue and Kevin Afougou. But Henrique levelled after the hour mark before Mariano nicked it.
St Etienne saw off Ligue 2 Caen 3-2 as Joshua Guilavogui scored either side of a Kevin Mayi strike, with Faycal Fayr registering a brace for the hosts.
First-half goals from Souleymane Camara and Emmanuel Herrera set up a 2-1 away win for Montpellier over National side Bourg-Peronnas.
Ligue 2 strugglers Sedan needed an injury-time winner from Mickael Le Bihan, his second, to beat Pontparlier 2-1 away, but fellow Ligue 2 side Arles-Avignon were knocked out by lowly Mende 2-0.
Meaux beat Le Portel 1-0 while Fontenay-le-Comte were 2-0 winners at Muret.
Paris Saint Germain were given a huge scare by amateur side Arras before eventually booking their place in the next round with a 4-3 victory.
PSG coach Carlo Ancelotti rested a number of his big names, including Zlatan Ibrahimovic, but the capital club looked comfortable as they raced into a 2-0 lead inside 10 minutes thanks to Ezequiel Lavezzi and Blaise Matuidi.
Arras pulled one back in the 26th minute through Moustapha Ait-Bouhou, before Zoumana Camara added PSG's third in the 40th minute.
Arnaud Despres got a second goal for the hosts in the 52nd minute to set PSG nerves jangling again until Lavezzi's second in the 68th minute restored their two-goal cushion.
Sebastien Bernard struck Arras' third with nine minutes remaining but PSG held on.
Ligue 1 Bastia suffered a huge shock as they went down to a 2-0 defeat at neighbours CA Bastia, the amateur side earning local bragging rights thanks to an Alassane Ndiaye strike and a Sylvain Marchal own goal.
Brest needed penalties to see off Lucon after a 1-1 draw, while Nantes were 3-2 winners away to Dieppe.