SPL leaders Hearts were pushed all the way to extra time by a spirited Forfar who put in an excellent shift in a cracking League cup tie.
And it took a controversial winner midway through that extra period to separate the sides, with gutted Forfar finishing with just nine men and manager Dick Campbell sent to the stand.
Hearts made four changes from the side that beat Partick Thistle at the weekend, while Forfar were without the trio of Gavin Swankie, Mark Baxter and Tom O’Brien who all limped out of the Loons’ win over Stenhousemuir.
Hearts pushed right from the off in a pattern of almost relentless one-way play.
Hearts continued to push forward after the interval.
Sam Nicholson curled an effort close from the corner of the box before penalty heroics from Forfar keeper Rab Douglas in the 70th minute.
Reilly turned Nicoll in the Forfar box and the defender was very unfortunate to drag the ball back with his hand as he fell. However, referee Greg Aitken pointed to the spot.
Reilly hit his shot low to the left but Douglas guessed correctly and dived full length to palm the ball away. He then recovered in time to block the follow up from Juanma.
Forfar’s hearts were finally broken in the 74th minute, however, as the Edinburgh side powered their way in front. Good build-up play from Juanma saw him force a ball through to McHattie, who hammered home an unstoppable strike from the left.
Then with seven minutes remaining, Forfar dragged themselves right back into the tie. Campbell hit a deep free kick that was missed by everyone except Michael Dunlop on the far right. He looped a header back in over Hamilton and into the net despite the efforts of two defenders on the line.
Forfar had a chance to steal it right at the end when Danny Denholm was clear through but blasted high over the bar with just Hamilton to beat.
And from the chance of glory, Denholm turned to villain as, in time added on, he saw red for a second, needless, booking, a midfield trip on Paterson.
Extra time with 10 men was a tough ask for Forfar but even tougher was the time-keeping of referee Aitken. With the fourth official having shown one extra minute, Hearts were awarded a corner 90 seconds after the 15. And from the cross Callum Paterson drilled home a low strike through a crowd of players.
Forfar boss Dick Campbell was incensed and was sent to the stand for his protests.
Forfar defended well and even threatened in the closing period, but their night ended under even more of a cloud as Nicoll was shown a straight red for a high challenge on Morrison right on full time.