Marcelo Bielsa's men came unstuck for the second successive match following Sunday's 1-0 defeat at Lyon, with Rennes staging a second-half comeback after Michy Batshuayi's first Marseille goal gave them a 19th-minute lead.
Anders Konradsen drew the hosts level in their third-round tie with an hour gone, heading in a left-wing free-kick.
Things turned ugly a few minutes later, though, as both sides were reduced to 10 men.
Rennes' Paul Ntep and Brice Dja Djedje of Marseille received straight red cards for their respective roles in an on-field fracas, with the former earning his dismissal just 140 seconds after coming on.
And with the match looking destined for extra-time, Philipp Hosiner flicked Cheikh M'Bengue's shot beyond Brice Samba in the 92nd minute, sparking wild celebrations among the home team.
Nice went into their clash with Metz on the back of a stunning 7-2 victory of Guingamp in Ligue 1 on Sunday and they found themselves involved in another thrilling encounter on Wednesday.
Visitors Metz raced into an unlikely 3-0 lead inside just 17 minutes at Allianz Riviera, with Jose Luis Palomino, Modibo Maiga and Thibaut Vion grabbing the goals.
The Nice fightback started soon after, though, as Neal Maupay pulled one back in the 20th minute before Alexy Bosetti added a second.
Dario Cvitanich completed the comeback in the 88th minute, converting a penalty after handball.
But all Nice's hard work was ultimately for nothing, as Metz triumphed 3-2 on penalties despite seeing Florent Malouda miss, with the crossbar denying Bosetti to give the visitors the win.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.