Andre-Pierre Gignac scored a second-half hat-trick as France came from behind three times to beat South Africa 4-3 and keep their Olympic hopes alive.
Having lost their Group A opener, France looked to be heading out until former Marseille striker Gignac completed his treble from the penalty spot to level for a third time on 85 minutes, before Teji Savanier grabbed an injury-time winner.
Gignac, who currently plays for Tigres in Mexico, is now top scorer in Tokyo with four goals from two matches.
South Africa, whose hopes of qualifying have now been ended, led three times through second-half goals from Kobamelo Kodisang, Evidence Makgopa and Teboho Mokoena.
Group leaders Mexico face second-placed hosts Japan later on Sunday, with the top two progressing into the knockout rounds.
Brazil held & Argentina have fresh hope
Defending champions Brazil were held to a goalless draw by Ivory Coast in Group D, after Aston Villa midfielder Douglas Luiz was sent off for a trip on former Leeds winger Max Gradel on just 13 minutes.
Luiz was initially booked but the yellow card was upgraded to red by VAR, after he was deemed as denying a goal-scoring opportunity.
Ivory Coast, who won their Olympic opener against Saudi Arabia, also had a player dismissed late on as Eboue Kouassi saw red for a second yellow card.
Brazil, captained by former Barcelona defender Dani Alves, still top the group after thrashing Germany in their opening match.
Elsewhere, Facundo Medina gave Argentina their first win of the Olympics with a 1-0 win over Egypt, while Burnley striker Chris Wood was on target in New Zealand's 3-2 loss to Honduras.