Guinea scored with the last kick of the game to end the giant-killing run of Equatorial Guinea at the Africa Cup of Nations.
The 1-0 victory at Alassane Ouattara Olympic Stadium on Sunday (Monday AEDT) earned Guinea a spot in the quarter-finals.
Mohamed Bayo's superb glancing header in the eighth minute of stoppage time in the last-16 clash proved the difference after Equatorial Guinea, down to 10 men in the second half, missed a penalty.
Guinea ended a long sequence of losing in the knockout stage of the Cup of Nations but took their time, and rode their luck, to claim victory.
It came after a spell of probing football at the end of the game and from an accurate cross on the right from fullback Ibrahim Diakite that Bayo expertly flicked into the net, in a small gap between the near post and the goalkeeper.
Guinea had brought on the Bundesliga-based pair of Naby Keita and Serhou Guirassy to inject urgency into their attack, and they slowly took command in the closing stages, setting up several chances.
Guinea had a man advantage from the 55th minute when Equatorial Guinea's influential midfielder Federico Bikoro was sent off for a high-foot tackle on Bayo.
Despite the disadvantage, Equatorial Guinea should have gone ahead just minutes later when Iban Salvador was clipped from behind in the penalty area by wing back Sekou Sylla.
It took a lengthy VAR review before the referee awarded the kick, but Emilio Nsue, the tournament's leading scorer with five goals, hit his effort against the upright with the goalkeeper going the other away.
Equatorial Guinea then looked to play for time and try to force the game to an extra 30 minutes and post-match penalties.
However, Guinea snatched victory to end the fairytale run of the small central African nation, which had finished ahead of hosts Ivory Coast and Nigeria in Group A.
Meanwhile, Egypt goalkeeper Mohamed Abou Gabal missed his penalty in the shootout as the Democratic Republic of Congo claimed an epic 8-7 victory following a tense 1-1 draw in their last-16 clash in San Pedro.
Abou Gabal clipped the crossbar with his effort and then opposite number Lionel Mpasi scored against him as record seven-time winners Egypt bowed out at the Laurent Pokou Stadium.
The result sparked jubilant scenes for the Congolese, who now play Guinea in the quarter-finals in Abidjan on Friday.
Meschack Elia gave DR Congo the lead in the game when he headed in virtually on the goal-line, but the advantage lasted nine minutes before Mostafa Mohamed scored his fourth goal of the tournament from the penalty spot on the stroke of half-time.
Egypt midfielder Mohamed Hamdy received a red card in extra time, after which the Pharaohs, without injured talisman Mohamed Salah, stopped attacking and held on as the game went to a shootout.