Burkina Faso sprung a major surprise at the African Nations Cup when they drew 0-0 with holders Zambia on Tuesday to reach the quarter-finals along with Nigeria, who beat Ethiopia 2-0.
Burkina Faso topped the Group C standings above Nigeria on goal difference, but Zambia crashed out following dramatic conclusions to the final round of matches.
Nigeria overcame strong resistance from Ethiopia in Rustenburg, but two late penalties from Victor Moses set up a heavyweight clash with the Ivory Coast in Sunday' quarter-finals. Burkina Faso will play Tunisia or Togo, ensuring at least one surprise semi-finalist.
Zambia's failure to beat Burkina Faso meant they suffered the ignominy of being the first holders to go out in the first round in defence of their title since Algeria in 1992.
Burkina Faso went into Tuesday's final group matches with a two-point advantage and quickly set about building a defensive fortress to keep Zambia at bay and seal a place in last eight for the first time since 1998.
But the holders were still in contention as long as Nigeria were being held goalless by Ethiopia, who had not been expected to put up such stout resistance.
Had both matches ended goalless, Zambia and Nigeria would have finished tied on points, goal difference and goals scored and would have had to be separated by their disciplinary records.
The scenario of a last-eight place being determined by a countback of yellow cards or toss of a coin was alive until Moses converted an 80th-minute penalty to put Nigeria ahead.
That meant Zambia had to go for the win against Burkina Faso to join them in the top two places and they threw everything forward to force a breakthrough.
They had been restricted to a single real chance in the 17th minute squandered by Collins Mbesuma.
Central defenders Stopilla Sunzu and Hichani Himoonde joined three strikers up front to create a siege on the Burkina goal, but the Burkinabe defended for all they were worth.
Centre back Bakary Kone suffered a cut to the mouth in a clash of heads and was bleeding in the final exchanges.
Coach Paul Put called it a historic night for Burkina Faso football.
"We had double motivation being close to qualification and playing against the champions. I told the players this chance might never come again," he told reporters.
As time ebbed away in Nelspruit, Nigeria added a second goal through another Moses penalty in Rustenburg.
Moses struck the second past outfield player Addis Hintsa, who had to go in goal after keeper Sasay Bancha was sent off for bringing down Moses in the box in the 85th.
Ethiopia had used all three substitutes and finished with 10 men for the second time in the competition after keeper Jemal Tassew was also dismissed in their opening match against Zambia.
"I was not really aware that we were absolutely level [with Zambia] because I was concentrating so much on our game, but in the end it did not matter," said Nigeria coach Stephen Keshi.
"I thought Ethiopia made it hard for us, they were very organised and played well, but we deserved it in the end." Zambia depart after three unconvincing draws, but a spirited finish.
Zambia coach Herve Renard said he could not fault his players.
"They gave everything," he said. "It's better to at least have one a title in your life than get to the quarter-final and crash out every time."