Craig Gordon was the Hearts hero, saving twice in a Scottish Cup penalty shootout win over St Mirren in Paisley.
Mikael Mandron gave the hosts a deserved lead during a fierce spell of first-half pressure, poking in from close range as Gordon parried a shot from Mark O'Hara.
Hearts forced extra time when late substitute Calem Nieuwenhof struck with his first touch.
Caolan Boyd-Munce saved St Mirren with a goal-line clearance from Elton Kabangu on 98 minutes before a drab period of extra-time.
Veteran Scotland international Gordon denied Oisin Smyth and James Scott from the spot, before Gerald Taylor missed for the visitors, but James Penrice held his nerve to send the Edinburgh side into the quarter-finals where they will host Dundee.
Gordon had been under pressure for long spells in the first half as Hearts struggled to deal with St Mirren's direct approach.
Toyosi Olusanya flicked a shot over the top and Jamie McCart needed to make a front post block after the forward skipped wide of Gordon to send in a dangerous cross.
Hearts did not pose much threat before the interval but Kabangu did have home goalkeeper Zach Hemmings at full-stretch to push away a powerful shot.
Olusanya and Killian Phillips threatened after the interval but the team from Edinburgh responded with Blair Spittal firing over and having an effort blocked.
Nieuwenhof, making his return from 11 months out injured, was the unlikely source of Hearts' equaliser, sweeping home from 10 yards just moments after coming off the bench.
With a flurry of substitutes and the pitch cutting up, the game grew scrappier the longer it went on, leaving Gordon to make the headlines late into the evening.
Hearts manager Neil Critchley: "Happy to have a home draw, happy to be in the quarter-finals.
"You know you're going to have to do the basics really well here, you have to compete with and without the ball and I didn't think we did that well enough in the first half.
"We grew into the game a little bit but didn't have the control over it that we'd have wanted.
"We had to fight and scrap and it's taken a big effort to get through."
St Mirren manager Stephen Robinson: "We were very good in the first half and probably could have killed the game off.
"We're really disappointed in the goal we conceded, we had two opportunities to clear it and we didn't.
"It goes to penalties and it's a lottery. I believe we should have had a penalty in extra time as well. It's not often I make comments like that but it looked blatant to me.
"I can't question the boys' attitude or desire, the people that stepped up to take penalties showed a lot of bravery."