A back-heel goal by Oumar Diakite in added time at the end of extra time gave hosts Ivory Coast a 2-1 win over Mali in Bouake on Saturday after a dramatic Africa Cup of Nations quarter-final.
Reduced to 10 men by a red card at the end of the first half, the Ivorians fell behind in the second half to a Nene Dorgeles goal only for Simon Adingra to equalise in the 90th minute.
The result marked another upward turn for the Ivory Coast in a roller coaster AFCON campaign in which they scraped into the knockout stage after a 4-0 hiding from Equatorial Guinea.
It was a heartbreaking outcome for Mali, who dominated for long periods and, despite missing a penalty, seemed set to maintain a record of never losing a Cup of Nations quarter-final.
Ivory Coast now return to Abidjan, where they will face the Democratic Republic of Congo on Wednesday in the semi-finals, but Diakite is set to miss out after picking up a second yellow card while celebrating his winning goal.
This was the sixth meeting of the countries in the AFCON with the two-time champions Ivory Coast winning four and drawing one previously against rivals whose best showing was 1972 runners-up.
Ivory Coast caretaker coach Emerse Fae made three changes to the lineup that started in the dramatic last-16 penalty shootout triumph over defending champions Senegal.
In came midfielder Franck Kessie, scorer of the winning penalty, winger Nicolas Pepe and forwards Christian Kouame in place of Ibrahim Sangare, Oumar Diakite and Jean-Philippe Krasso.
Mali had one enforced change to the team that defeated Burkina Faso to set up the west African showdown with Diadie Samassekou replacing ill Mohamed Camara in midfield.
Mali made light of the fact that the majority of the capacity 40,000 crowd in the central city were supporting the host nation and established early dominance.
The Eagles had an appeal for a penalty rejected after the ball struck the outstretched hand of Odilon Kossounou because there had been an earlier offside.
But when Kossounou fouled Lassine Sinayoko, the Egyptian referee pointed to the spot only for Adama ‘Noss’ Traore to have his 17th-minute penalty saved by Youssouf Fofana.
Ivory Coast were battling to create chances until just before half-time when Seko Fofana blazed over when offered a good chance just outside the area.
A troubled first half for Kossounou got worse on 44 minutes when shown a yellow card for the second time, after clipping Sinayoko, and was sent off.
Fae immediately brought on Wilfried Singo to bolster the defence with Pepe sacrificed, and Ivory Coast were lucky to still be level when the half ended.
Mali attacked continuously against 10 men and finally broke the deadlock when Dorgeles raced across the pitch and from just outside the D unleashed a shot that flew past Fofana.
Substitute Diakite came close to levelling, with his header from a corner finishing just off target.
Diakite was involved in the last-gasp equaliser with Adingra pouncing on a deflection off Boubakar Kouyate inside the area and hammering the ball past goalkeeper Djigui Diarra.
Another Ivorian substitute, Sebastien Haller, headed against the crossbar in the first half of extra time.
Download our app and read this and other great stories on the move. Available for Android and iOS.