Cote d'Ivoire surrendered their lead twice but still managed to reach the Olympic Games after beating Ghana 3-2 on penalties following an exciting 2-2 draw at Cairo's International Stadium on Tuesday.
Keeper Ira Tape proved Cote d'Ivoire's hero, saving three spot-kicks including the last one from Ghana's Owusu Kwabena as his side sealed Africa's first place at next year's Tokyo Games after reaching the U23 African Cup of Nations final.
Cote d'Ivoire were the better side throughout, grabbing a 13th-minute lead when Youssef Dao fired home after breaking clear and were unlucky not to increase their lead in a first half they totally controlled.
Dao missed a sitter from inside the area, Cheikh Timite should have been awarded a penalty and Hamed Traore struck the woodwork with a fierce shot.
The Elephants were punished for their wastefulness when Yaw Yeboah brought Ghana level six minutes after the interval, drilling a low shot past the keeper after a cut-back from the left.
Dao looked to have sealed a win for Cote d'Ivoire though when he stopped to meet an inviting left-wing cross with a superb header that found the roof of the net on 85 minutes.
However, Evans Mensah equalized for Ghana in stoppage time, with his low shot beating the keeper at his near post after his side were harshly denied a clear penalty in the build-up.
Both sides squandered goal-scoring chances in an end-to-end extra time until they were separated in the shootout.
Ghana can still book a place in the Olympics if they win the third-place playoff against either Egypt or South Africa, who meet in the other semi-final later on Tuesday.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)