Sudan won their first match at the Africa Cup of Nations Cup for 42 years on Monday with a 2-1 victory over Burkina Faso which took them to the quarter-finals helped by Angola's blundering defence.
Needing a draw to qualify on a dramatic evening, Angola lost 2-0 to Ivory Coast who had already booked their place in the last eight and who had made nine changes to their starting line-up.
Sudan and Angola both finished Group B on four points but the Sudanese qualified with a level goal difference compared to Angola's minus one.
Ivory Coast, favourites to win the title alongside Ghana, finished the group with maximum points without conceding a goal.
Sudan, whose entire squad consists of home-based players and who had not won in their 11 previous outings at the tournament, will face Zambia on Saturday.
Angola's frustration boiled when around 20 riot police from the country entered the interview area outside the dressing-rooms to stop reporters asking questions to the players.
One Angolan journalist said they had been threatened with reprisals on their return home if they showed television footage or reported the incident.
Ivory Coast gave arguably their best performance of the tournament, leaving coach Francois Zahoui with a selection headache for their quarter-final against Equatorial Guinea on Saturday.
"It was a good performance and people will be happy with the way we played, but we have to keep our heads cool because we have a job today," said the coach, who has given the Elephants a more cautious approach after attacking play failed to bring them the title at recent tournaments.
"We always put Angola first," said coach Lito Vidigal. "We had a lot of problems which I don't even want to talk about. My players did a fantastic job."
Angola appeared to have a fairly comfortable task in Malabo, given Sudan's record, but their evening began to fall apart when Miguel Quiami failed to cut out Wilfried Bony's pass across the area, leaving Emmanuel Ebouye to tap into an empty net.
One minute later, Mudather Tayeb scored against the run of play in the 33rd minute to give Sudan the lead in Bata.
That meant that one more goal, either for Sudan or against Angola, would send the Sudanese through.
It duly arrived in the 62nd minute, courtesy of slapstick defending by Angola defener Dani Mussunguna. Abdulkader Keita played a long forward into the Angola area and Mussunguna, under no pressure, headed the ball back towards goalkeeper Wilson Pereira.
The ball sailed over the stranded Pereira, leaving Bony to tap in and claim the credit for the goal.
Sudan scored their second in the 80th minute as Tayeb took advantage of comical goalkeeping from Daouda Diakite, who hesitated to clear a long ball allowing Tayeb to steal the ball and score the easiest of goals.
Burkina Faso substitute Issiaka Ouedraogo pulled a goal back with virtually the last touch of the match after he had missed two gilt-edged chances.
The first came early in the second half, with just the goalkeeper to beat, and the second late in the game when he managed to get around the goalie but still hacked wide.
Burkina Faso, who lost all three matches, fielded 16-year-old Chelsea academy player Bertrand Traore as a second half substitute, making him the third youngest player in the history of the tournament.
Meanwhile, Angola were twice close to snatching a goal which would have sent them through on goals scored.comments