Gabon have qualified for the Olympic Games football tournament for the first time after beating Senegal 1-0 in the African Under-23 Championship.
Substitute Andre Biyogo Poko was his country's hero when he headed in a corner in the last minute of extra-time, after both sides had failed to break the deadlock over 90 minutes.
Senegal have another chance to qualify for London 2012 on Saturday in the third-place play-off.
Egypt play hosts Morocco in the other semi-final on Wednesday night.
In a scrappy first-half, Gabon thought they had taken the lead after 16 minutes when Romuald Ntsitsigui reacted quickest to bundle the ball over the line after it had rebounded off a post only for the linesman's flag to go up.
Senegal then began to dominate the game after the break, without creating too many clearcut chances, as Gabon defended in numbers and looked happy to use the counter-attack.
Serigne Kara Mbodj should have won the game for Senegal in injury time at the end of the 90 minutes but he rushed his shot and put the ball high over the bar with the goal at his mercy.
Senegal also had better opportunities to score in extra time, with Lamine Gassama seeing an acrobatic shot well saved before Mbodji had two headers go wide.
With a penalty shoot-out looking likely, Poko scored the goal that created history for Gabon.