Olivier Simouri's 90th minute strike secured a shock 2-1 win for Madagascar over Ghana at the Royal Bafokeng Stadium in Rustenburg on Monday.
Madagascar will now face fellow giant killers Namibia for a place in the 2015 Cosafa Cup final while Maxwell Konadu's men drop into the Plate semifinals.
The Black Stars threatened early on with Hans Kwofie splitting the Madagascar defence, but Jean Randrianasolo was quick off his line to swoop the ball from Nathaniel Asamoah's feet with 18 minutes on the call
Randrianasolo looked nervy between the sticks for the islanders and the Madagascar gloveman watched anxiously as Lanto Andriamanalina guided the ball onto the inside of his own upright a minute later.
Fatau Dauda on the other hand looked solid in goal for Ghana, but the former Orlando Pirates man could do nothing to keep out Michel Randriamanjaka's crisp strike in the 27th minute.
The Madagascar striker steered an unstoppable free-kick into the back of the net for his third goal of the tournament.
'Barea' looked good for the lead at the break, but Randrianasolo was to blame as the Black Stars found the equaliser through Daniel Darkwah in the 39th minute. His 30-yard effort directed into the back of the net via the inside of the post by the Madagascar goalkeeper.
Ghana fancied their chances from long range and Randrianasolo was lucky to see Michael Akuffo's powerful shot go wide after slipping through his gloves 10 minutes into the second stanza.
The West Africans continued to press forward in search of the winner as the weary Islanders looked happy to settle for the lottery of the penalty shoot-out.
Simouri though had other plans with his incredible shot from an acute angle flying over Dauda's head before hitting the back of the net to send Madagascar into the final four.
Ghana starting XI: Dauda, Saka, Akowuah, Akuffo, Darkwah, Tijani, Nelson, Kwofie, Adams, Mohammed, Asamoah
Madagascar starting XI: Randrianasolo; Njakanirina, Andriamanalina, Janahary, Fenolahy, Rakotoarimalala, Razanakoto,Rabeson, Simouri, Randriamanjaka, Claudel