Cameroon scored twice with time ticking away on Tuesday to snatch a dramatic 3-2 win over Gambia, secure an Africa Cup of Nations last-16 place, and eliminate Ghana from the tournament.
In an amazing finish in Bouake, Ebrima Colley scored on 85 minutes to put Gambia 2-1 up only for Joseph Gomez to concede an own goal before an added-time Christopher Wooh goal won a thriller.
Defending champions Senegal beat Guinea 2-0 in the other Group C match to finish with nine points and Cameroon edged Guinea for second place on goals scored after both collected four.
Gambia lost all three matches to finish pointless, but played their part in one of the most remarkable matches so far in the tournament.
Victory for five-time champions Cameroon meant four-time winners Ghana were eliminated after finishing third with only two points in Group B on Tuesday.
Hosts Ivory Coast, who suffered a stunning 4-0 defeat by Equatorial Guinea on Monday, will survive if Zambia and Tanzania lose their final Group F matches on Wednesday.
The match was a repeat of a 2022 AFCON quarter-final, which hosts Cameroon won 2-0 with Toko Ekambi scoring both goals.
Toko Ekambi was restored to the starting line-up by coach Rigobert Song after playing in a draw with Guinea and being an unused substitute in a loss to title-holders Senegal.
Belgium-born Gambia coach Tom Saintfiet made five changes to the team that started against Guinea as they sought their first points and first goal of the tournament.
– Fast tempo –
Although Cameroon are 80 places above Gambia in the world rankings, they came under considerable first-half pressure and were lucky to be level at 0-0 by half-time.
Ondoa, a cousin of Onana, parried a hard close-range shot from Ali Sowe to safety in the early stages at the 40,000-seat stadium in the central city.
The goalkeeper rescued Cameroon again after 35 minutes, eventually grasping the ball after a Yankuba Minteh header after a corner appeared goal-bound.
Ondoa was in action again soon after, diving to push away a snap shot by Musa Barrow, who either scored or created the four Gambian goals at the last AFCON.
Although the opening half produced no goals there was plenty to entertain a good crowd with the tempo surprisingly fast given the temperature at the kick-off was 34 Celsius (94 Fahrenheit).
Winger Georges-Kevin Nkoudou was prominent early in the second half as Cameroon finally applied pressure.
He had a genuine penalty appeal after a tackle from behind ignored by the Ethiopian referee, then rattled the woodwork with a close-range drive.
Cameroon were barely recognisable from the team that struggled in the opening half and they broke the deadlock on 56 minutes through Toko Ekambi.
The Saudi Pro League star got between two Gambian defenders and stayed just onside to powerfully head a Nkoudou cross past goalkeeper Baboucarr Gaye.
Gambia refused to panic, however, pushed forward and levelled on 72 minutes when Ablie Jallow stroked a cross wide of Ondoa and into the net.
The match was being fought at a frenetic pace and Toko Ekambi burst into the area and watched in despair as his shot rebounded off the crossbar.
Then came the sensational climax with three goals in six minutes before Cameroon set up a last-16 showdown with Nigeria on Saturday.