Marius Zaliukas' extra-time winner earned Hearts a 2-1 victory over St Johnstone in the fifth round of the William Hill Scottish Cup at McDiarmid Park.
Murray Davidson's goal after 83 minutes appeared to have St Johnstone on course for a place in the quarter-finals before Jamie Hamill levelled in injury-time from the penalty spot.
St Johnstone dominated the majority of extra-time, but Zaliukas prodded home with three minutes remaining after the hosts' defence failed to deal with Hamill's dangerous corner.
Andrew Considine grabbed an injury-time winner to book Aberdeen's place in the last eight with a 2-1 win over Queen of the South.
Fraser Fyvie's opportunist goal gave the Pittodrie club a deserved 1-0 half-time in this fifth-round replay as the sides met again following a 1-1 draw in the original tie at Pittodrie.
But Queen of the South's Ryan McGuffie equalised with a penalty and Aberdeen survived a few scares before Considine struck two minutes into injury time. Craig Brown's side will now face Motherwell at Fir Park in an all Scottish Premier League last-eight tie.
St Mirren made it through to the quarter-finals after a hard-fought 2-1 victory over Ross County at Victoria Park.
Gary Teale gave Saints the lead in the 14th minute with a thunderous from 20 yards - and the Paisley side looked out of sight when they doubled their advantage after 52 minutes when Nigel Hasselbaink swept home a Graham Carey assist.
However, the Division One side were thrown a lifeline three minutes later when Sam Morrow headed home a Rocco Quinn free kick. But despite late pressure from County the Scottish Premier League side held out for a place in the last eight.