Tonga produced an inspirational display in Wellington to defeat France 19-14 in one of the World Cup's biggest upsets, but Vincent Clerc's last-gasp try ensured Les Bleus will nevertheless progress to the quarter-finals.
Clerc dramatically crossed for his fifth try of the tournament in the last minute to clinch the losing bonus point which secured France's last-eight berth, but there were few other positives for Marc Lievremont's side.
The Tongans won the physical battle for much of the Pool A encounter and led 13-6 at half-time, helped by a try from wing Suka Hufanga, and extended that advantage to 19-9 before Clerc touched down in the final moments.
The margin of victory could have been even greater had Kurt Morath not missed four of his eight penalties and Samiu Vahafolau not squandered a certain try.
Both sides had a player sent to the sinbin for lifting tackles. Hufanga got his yellow card two minutes before the break, while Fabrice Estebanez was sent off for 10 minutes midway through the second half.
Dimitri Yachvili (two) and Morath traded penalties to give France a 6-3 lead with a quarter of the match gone before Hufanga scored his try after a strong run from halfback Taniela Moa and a great cross-field kick from Morath, who added the conversion.
Morath then kicked another penalty to stretch the Tongans' lead to 13-6.
Then in the 38th minute, referee Steve Walsh, in consultation with his assistants Carlo Damasco and Dave Pearson, sent Hufanga to the sin bin. The ragged French could not make the extra man count and wasted another chance when Servat and Jean-Baptiste Poux got in each other's way and the prop knocked on, bringing an end to the first spell.
France continued to create and waste opportunities in the second half and had only a third Yachvili penalty to show for their efforts in the 20 minutes after the break as Tonga muscled up on defence and harried Les Bleus into mistakes, but Morath's wayward kicking meant the French did not pay on the scoreboard.
Then in the 65th minute French replacement Estebanez lifted Joseph Tuineau in the tackle and was shown a yellow card and Morath slotted the resulting penalty to put Tonga 16-9 ahead. Morath added another three-pointer with eight minutes to go before Clerc's last-ditch try took France into the last eight.