Four-time champions Ghana were eliminated from the Africa Cup of Nations after crashing 3-2 to minnows Comoros in Group C on Tuesday in Garoua.
The Black Stars had captain Andre Ayew sent off after 25 minutes and, after wiping out a two-goal deficit, lost when Comoros’ Ahmed Mogni scored his second goal five minutes from time.
Morocco and Gabon drew 2-2 in Yaounde in the same group to retain first and second places respectively and qualify for the Round of 16, which kicks off on Sunday.
Comoros, representing a tiny island nation off the southeast coast of Africa, finished third and must wait until Thursday to know if they are among the best four third-placed teams, who get the last 16 spots.
A disastrous night for Ghana started after just four minutes when Serbia-based El Fardou Ben Mohamed fired the first-time qualifiers in front.
Mogni, who plays for French third-tier club Annecy, added a second just past the hour only for 10-man Ghana to hit back through goals from Richmond Boakye and Alexander Djiku.
Mogni struck again when he pushed a low cross from Ben Djaloud past goalkeeper Joseph Wollacott to give the islanders a stunning triumph.
In Yaounde, Gabon led twice through Jim Allevinah and a Nayef Aguerd own-goal while Sofiane Boufal and Achraf Hakimi netted for Morocco.