The Bairns broke the quarter-final deadlock at Pittodrie when French defender Mehdi Khalis nodded home Kallum Higginbotham's back-post corner after 33 minutes, although the Dons felt they should have been awarded a free-kick for a foul on Rory McArdle in the build-up to the set-piece.
However, Aberdeen skipper Hartley equalised after 64 minutes to ensure the match went the distance when he headed Darren Mackie's inviting cross past Robert Olejnik in the Falkirk goal.
And when Chris Maguire was brought down in the area by Khalis in the third minute of injury time, Hartley stepped up to send Olejnik the wrong way to put the Dons into the final four of the competition.
Aberdeen boss Mark McGhee handed 17-year-old Clark Robertson a rare start at the expense of Togolese midfielder Yoann Folly, who missed out with an ankle injury.
Zander Diamond, however, passed a late fitness test to take his place at the heart of the Dons defence against a Falkirk side unchanged after the weekend win over Queen of the South.
The match had been given some added spice by a war of words between the two mangers prior to the encounter with Falkirk manager Steven Pressley accusing McGhee of not respecting his side, a claim the Dons boss emphatically denied.
Despite being relegated from the SPL last term Falkirk managed to take seven points from 12 against the Dons and ended a 52-year winless hoodoo at Pittodrie in February under former boss Eddie May.
The home side were eager to take advantage of the greasy surface with Mackie's low drive blocked by defender Khalis and Chris Maguire's drilled shot comfortably gathered by Olejnik.
Falkirk settled soon after and Khalis should have done better than head over the bar when he rose highest in the box to meet Higginbotham's corner.
Diamond was next to squander a decent goalscoring opportunity when, after Mackie had nudged Paul Hartley's corner into his path, the defender failed to connect properly with the ball and his weak effort was cleared to safety.
Falkirk were growing in confidence as the half wore on with Ryan Flynn releasing striker Carl Finnigan with an intelligent pass - but the Englishman's powerful shot was charged down by Hartley.
The visitors took the lead after 33 minutes. The Dons defenders felt they should have been awarded a free kick for a foul on Rory McArdle but instead referee Stevie O'Reilly awarded a corner and the visitors took full advantage with Khalis heading home Higginbotham's corner at the back post.
The Dons had a chance to test Olejnik in the final minute of the first half but Marc Twaddle bravely headed Hartley's corner to safety to ensure his side took the one-goal lead into the break.
With their manager's words still ringing in their ears, the Dons came out for the second half determined to level at the earliest opportunity.
Midfielder Sone Aluko blasted a free-kick from 25 yards into the Falkirk wall after 48 minutes before drawing a fine save from Olejnik with a powerful shot a minute later.
The Dons were awarded another free-kick on the edge of the area following a handball by goalscorer Khalis but this time it was Hartley who could find no way past the Falkirk wall.
But the Dons captain redeemed himself after 64 minutes when he headed Mackie's cross past Olejnik to the delight and relief of the home support.
Aberdeen were in the ascendancy but they almost fell behind again when Flynn nipped past Jerel Ifil with ease before unleashing a powerful strike that Mark Howard managed to punch clear.
With less than 10 minutes remaining Higginbotham got himself into a promising position but McArdle made a vital block to deny the midfielder.
And the game took a dramatic twist in the fourth minute of injury time when Hartley scored his seventh penalty of the season after Khadis had fouled Maguire in the box to put the Pittodrie side into Friday's semi-final draw.