Ivory Coast ensured they finished Group B with a perfect record as they beat a disjointed Angola 2-0 in Malabo.
The Angolans' first group defeat means they miss the quarter-finals after Sudan beat Burkina Faso 2-1 in Bata.
Angola gifted an Ivorian reserve side the lead as Emmanuel Eboue pounced from close range after 33 minutes, before Wilfried Bony tapped into an empty net.
Ivory Coast will play Equatorial Guinea in the quarter-finals, while Sudan will face Zambia in Bata on 4 February.
After qualifying for the last eight with a game to spare, Elephants coach Francois Zahoui rested nine players as only centre-backs Kolo Toure and Sol Bamba survived from the 2-0 win over the Burkinabe.
In their place came Russia-based Seydou Doumbia, Bony and Eboue among others, for a match where Angola's Palancas Negras needed to avoid defeat to be sure of reaching their straight quarter-finals.
The southern Africans proved the masters of their own downfall however, failing to apply any real pressure to reserve Ivorian goalkeeper Daniel Yeboah until the closing stages of the match.
By then, it was too late after their defence ceded two soft goals.
After Bony tested goalkeeper Wilson, playing in place of the suspended Carlos, with a well-hit drive after 14 minutes, the impressive striker created the opening goal just after the half hour.
Driving into the box with pace, power and purpose, the Holland-based forward clipped in a cross which Miguel could only fumble into the path of Eboue, who had the easiest of chances from two yards out.
Seconds later, news filtered through that Sudan had taken the lead against Burkina Faso - meaning Angola's continued participation at these finals was hanging in the balance.
Needing a goal, they failed to test Yeboah in the rest of the half, despite Gilberto's menacing free-kick almost unlocking the door.
Despite the best efforts of the few hundred Angolan fans inside the Malabo arena, the Elephants' reserves continued to coast and doubled their lead following another calamitous piece of defending after 64 minutes.
Subsitute Abdul Kader Keita curled a stunning pass behind the Angolan backline which Massunguna unwittingly headed past the onrushing Wilson, allowing a gleeful Bony to poke into an empty net.
The swing in goal difference meant Sudan were now going through, provided they held onto their lead, and coach Lito Vidigal was forced into action, replacing captain Andre Macanga with Nando Rafael.
The switch helped as the southern Africans finally threatened a defence which has yet to concede at the finals.
Manucho, the tournament's joint top scorer with three goals, finally forced Yeboah into action as he flicked on a corner before Mateus inexplicably failed to pull the trigger with the goal at his mercy.
At the other end, Bamba could have made it three when heading wide as the Ivorians won their third group game to ensure their bid for a first Nations Cup title since 1992 stays firmly on track.