(CNN) -- Burkina Faso's fairytale at the Africa Cup of Nations will have one more enthralling chapter after it overcame the might of four-time champion Ghana to seal a place in the final for the very first time in South Africa Wednesday.
In a contest which was marred by a number of mystifying refereeing decisions, Burkina Faso survived the sending off of striker David Pitroipa and the ruling out of a seemingly legitimate strike to prevail on penalties.
With the game ending 1-1 after extra-time, it was the Burkinabe which held its nerve to progress 3-2 on penalties and advance to Sunday's showpiece final against Nigeria.
The Super Eagles had earlier booked their place in the final with a convincing 4-1 win over Mali in Durban.
Burkina Faso, which had not won a game away from home at the tournament before arriving in South Afirca, had endured a frustrating night with referee Jdidi Slim's display a constant cause of consternation.
But it will now have to take on Nigeria without star striker Jonathan Pitroipa, who was harshly shown a second yellow card for diving when it looked as if he had been fouled.
Pitroipa's 117th minute dismissal leaves the Burkinabe without its two star strikers following the injury to talented forward Alain Traore.
Burkina Faso should have been given the chance to take an early lead when John Boye sent Pitroipa hurtling towards the turf inside the Ghana penalty area, but the referee wrongly waved away appeals for a spot kick.
Instead, it was Ghana which was controversially awarded a penalty after the Jdidi adjudged that Christian Atsu had been fouled inside the penalty area.
Mubarak Wakaso stood up to fire home from 12 yards and net his fourth goal of the competition.
With both teams struggling to play on a terrible surface at the Mbombela Stadium, the game lacked any real sort of quality.
But what it lacked in quality it more than made up for in drama and excitement as Burkina Faso continued to fight back against a perceived injustice.
Ghana goalkeeper Fatawu Dauda produced a wonderful reaction save to deny Aristide Bance, while Asamoah Gyan hit a post for the Black Stars.
But with an hour on the clock, the underdog finally got its reward as Bance was allowed time and space to fire home a deserved equalizer.
With the game moving into extra-time, Burkina Faso appeared to have scored a dramatic winner when Prejuce Nakoulma beat Dauda to the ball and prodded into the net.
But most of those packed inside the stadium were left in disbelief when Jdidi ruled the goal out for a minor clash with Kwadwo Asamoah.
Worse was to follow for the Burkinabe when Pitroipa was sent off after receiving a second yellow card for diving , despite replays showing he was quite clearly fouled.
In the end, the contest went to penalties and it was Burkina Faso which held its nerve with Bakary Kone, Henri Traore and Bance all scoring to send it through to the final.
Burkina captain Charles Kabore told reporters: "The referee is human, all humans make mistakes, but he happened to make too many tonight. But we're not going to dwell on that, we've qualified."
In the day's early kick off, Nigeria reached the final for the first time since 2000 following a comfortable victory over Mali.
The Super Eages scored three times in 20 first half minutes to take control of the contest and leave manager Stephen Keshi dreaming of repeating the triumph he pulled off as a player in 1994.
Elderson Echiejile headed Nigeria ahead on 25 minutes before Brown Ideye added a second on the half-hour mark.
Momo Sissoko then deflected Emmanuel Emenike's free-kick into the Mali net to leave his side facing an uphill struggle.
And Ahmed Musa, who replaced the injured Victor Moses , inflicted further punishment on Mali when he ran through to score eight minutes after the interval.
Mali, which famously came back from 4-0 down to draw 4-4 with Angola in the opening game of the 2010 finals, pulled one back through substitute Cheick Diarra in the 75th minute.
But that failed to take the shine off for manager Keshi, who is now hoping to become only the second man in the tournament's history to win the tournament as a player and a coach after Egypt's Mahmoud El Gohary, who won it in 1959 and 1998.
"We won in 1994 after we had been together for five years," he told reporters.
"But we have been together for five weeks. We met up for the first time in our training camp in Portugal before the tournament, and it was a young group.
"We worked hard, the atmosphere was wonderful but you cannot compare this team to that. We did play very well today and I am very happy but we haven't won anything yet."