Burkina Faso survived the controversial late dismissal of Jonathan Pitroipa to book their first ever appearance in the African Nations Cup final with a 3-2 victory on penalties over Ghana in Nelspruit.
Ghana took the lead through a Mubarak Wakaso penalty in the first half but neither side could force a winner after Aristide Bance levelled on the hour.
In the shootout, Isaac Vorsah set the tone for Ghana with a terrible miss from 12 yards, the ball bobbling wide to the delight of the Burkina Faso faithful.
Another lamentable effort by Emmanuel Clottey had Ghana in even more trouble, and with Burkina Faso netting through Bakary Kone, Henri Traore and Bance, the shootout was settled when Emmanuel Agyemang-Badu's effort was saved by Daouda Diakite.
The penalty showdown was a fitting finale to an enthralling contest over 120 minutes.
The dreadful, sand-covered pitch at Mbombela Stadium might have been a major talking point on any other night, but instead it was referee Slim Jedidi who took centre stage with a string of controversial calls - most of which went against Burkina Faso.
First the official awarded a soft penalty from which Ghana took the lead, before harshly ruling out a goal for Burkina Faso in extra-time.
But it was the dismissal of Pitroipa that left most observers scratching their heads, the striker sent off after receiving a second yellow card in the 117th minute for simulation despite appearing to be caught by a defender in the area.
That Burkina Faso survived his dismissal will be scant consolation to Pitroipa, who cut a distraught figure as the rest of his team-mates celebrated sealing their place in Sunday's final against Nigeria - for which he will be suspended.
Ghana went ahead on 13 minutes as Madi Panandetiguiri was harshly ruled to have pulled down Christian Atsu as the pair challenged in the area.
Wakaso did not lose concentration amid the fierce protests of the Burkina Faso defence, duly slotting a fine penalty kick low into the right corner.
It was Wakaso's fourth goal of the tournament - and third from the penalty spot.
Asamoah Gyan should have made it 2-0 on 58 minutes when he tried to steer home Atsu's cross on the run but his effort came back off the right-hand post.
Gyan's miss looked costly two minutes later as Burkina Faso levelled.
Agyemang-Badu was robbed of possession in midfield and the ball was fed to Bance, who found a huge gap between the centre-backs and had time to pick his spot.
Burkina Faso were lucky to keep 11 men on the pitch when Paul Koulibaly appeared to kick Gyan in the groin after a tangle in the box inside the final 10 minutes.
The offence appeared worthy of a red card and a penalty, but the referee instead brandished a yellow card - much to the bemusement of the men in white.
The last chance for either team in normal time came on 84 minutes when Atsu fired in an effort from the edge of the area but Diakite got down to save.
In extra-time, the Burkinabe spurned a chance in the 99th minute when Kone headed over the bar from Kabore's corner while unmarked six yards out.
Paul Put's men continued to press the Ghana backline but luck was not on their side in the 105th minute when Prejuce Nakoulma prodded the ball into the net only for the referee to pull the play back for a soft foul.
And the referee made another debatable call in the 117th minute as Pitroipa advanced into the area and was clearly caught by the outstretched leg of John Boye.
The Burkina Faso bench rose as one to claim a penalty, but instead the referee went to his pocket to brandish a second yellow card for simulation.
Gyan flashed a header wide in the 119th minute as Ghana's final chance went away.
But it was Burkina Faso who finished on the front foot, Bance's turn and shot deflected over in the last meaningful attack as the lottery of penalties was required to settle a breathless encounter.