Coupe de la Ligue Wrap: Nantes set up PSG clash, Lyon edge past Marseille
Midfielder Didier Digard put Nice ahead after 17 minutes, only for Serbian striker Filip Djordjevic to turn things around for the hosts with two goals in the first seven minutes of the second half.
Left-back Timothee Kolodziejczak restored parity on 72 minutes, before Venezuela defender Oswaldo Vizcarrondo put Nantes in front once more.
Nice, though, would not lie down and levelled yet again through Argentine striker Dario Cvitanich four minutes from time.
However, that was not the end of the drama as Togo forwad Serge Gakpe struck the winner just a minute later, securing a last-four meeting with PSG, who beat Bordeaux 3-1 on Tuesday.
Lyon survived a late rally from Marseille to progress to the next round with a 2-1 home win in a rematch of the 2012 final.
Marseille won 1-0 on that occasion, but midfielder Yoann Gourcuff opened the scoring 24 minutes in when he pounced on an error from Marseille goalkeeper Steve Mandanda to net on his 100th appearance for Lyon.
That lead was doubled by striker Bafetimbi Gomis on 74 minutes and, although Andre-Pierre Gignac scored from the penalty spot in the dying stages after Jimmy Briand handled in the area, the hosts clung on to claim victory.
Remi Garde's men will now face Ligue 2 Troyes following their surprise 3-1 win over Evian.
First-half goals from midfielder Benjamin Nivet and attacker Ghislain Gimbert put the hosts in command before Clarck N'Sikulu pulled one back for Evian.
But Troyes made sure of a semi-final spot three minutes into injury time thanks to substitute Jimmy Cabot's effort.