Saints were unfortunate to be denied the lead in a first half full of incident, with a penalty awarded for handball against Marius Zaliukas when the slightest hesitation from referee Stevie O’Reilly would have seen Nigel Hasselbaink put the hosts in front.
Graham Carey saw his 13th-minute spot-kick saved by Jamie MacDonald and Jamie Hamill, who earlier hit the post, fired Hearts in front after 31 minutes.
Rudi Skacel made certain of victory after 86 minutes, converting Andrew Driver’s cross as Hearts progressed to the last four, where they will meet Premier League leaders Celtic on April 15.
Striker Craig Beattie, a Buddies target before he opted for Edinburgh, was excellent as a Hearts side awaiting their overdue March wages marched on to Hampden.
An all-Edinburgh final remains possible, with Hibernian taking on Aberdeen in the other semi.
It was an own goal from Zaliukas, available again tonight after missing last weekend’s Edinburgh derby through suspension, which earned the Buddies a 2-2 draw at Tynecastle.
However, Saints were worthy of a second opportunity and seemed determined to take it as they dominated the early exchanges.
After Skacel shot wide in the opening minute, the Buddies went on the attack, with Carey’s left foot a potent weapon.
MacDonald palmed away one Carey cross with Nigel Hasselbaink and Steven Thompson poised to pounce before the goalkeeper saved after Jim Goodwin failed to strike the ball cleanly after another cross from the left-back.
The same source had Hearts toiling soon after and Saints were awarded a penalty by referee O’Reilly after 12 minutes, although they were unfortunate not to go ahead.
Zaliukas was adjudged to have handled while challenging Thompson in the air and Hasselbaink found the net with the rebound, but the whistle had already gone.
Carey’s resulting spot-kick was well struck low to the right, but MacDonald made an excellent save.
Gary Teale shot wide soon after before Saints goalkeeper Craig Samson saved well from Driver.
Samson was beaten in the 23rd minute, but Hamill’s shot from 25 yards hit the upright as Saints survived.
Saints were pressing Hearts across the field, but were punished for a lapse in concentration as Marc McAusland only half cleared a cross from Danny Grainger and Hamill’s shot from the edge of the area went into the bottom corner.
Some physical challenges were being dished out by both sides and Hearts boss Paulo Sergio was spoken to by O’Reilly after taking exception to one Thompson foul on Grainger which earned the Saints striker a yellow card.
Samson saved a swerving Beattie shot, Ian Black shot wide and Hamill wildly over as Hearts finished the half in the ascendancy.
The visitors had the majority of possession in the opening stages of the second half, without threatening Samson’s goal.
St Mirren right-back David van Zanten burst down the wing on a counter attack and elected to shoot early, but his effort went wide.
Hearts were winning the midfield battle and Beattie was proving a handful as an outlet up front, keeping Saints in their own half.
Skacel fired a warning shot from the edge of the box, forcing Samson to concede a corner, from which Zaliukas headed wide.
Hasselbaink sliced wide as Saints looked for an opening and MacDonald parried clear a Teale shot as Hearts held onto their slender lead.
With four minutes remaining, good work by Driver down the left found Skacel, who tucked the ball beyond Samson to seal victory and a place in the semi-finals.