St Johnstone earned the right to face St Mirren away in the fifth round of the William Hill Scottish Cup with a deserved win at Cowdenbeath.
After a goalless first half, the Perth outfit slowly eroded the First Division hosts' resolve after the break.
David McCracken stole in to open the scoring in the 54th minute.
Steven MacLean scored a penalty when Thomas Flynn fouled Murray Davidson, before Gregory Tade sealed the win from close-range three minutes from time.
Cowdenbeath's Central Park was able to host the tie at the fifth time of asking, and the First Division side can be proud of a competitive performance, even if they were ultimately undone by the superiority of the visitors.
St Johnstone boss Steve Lomas opted to shake things up from the 2-2 draw with Hearts at the weekend, with five changes to his starting line-up.
Weary legs were of greater concern to Cowdenbeath player-manager Colin Cameron.
The former Scottish international omitted himself from the starting line-up after featuring in his side's 2-0 defeat at Falkirk on Saturday, their first game in three weeks.
No clear-cut chances were forthcoming in the opening 30 minutes - and it was the hosts who came closest to opening the scoring.
Slack play in the centre led to a Cowdenbeath break with Mark McKenzie being given sufficient time to whip in a deep cross from the left. Lewis Coult's cushioned header found Dean Brett but the attacker's drilled shot went past the far post.
With the hosts finding their feet the game opened up and Liam Craig was granted too much space in a central area where he cracked the post from 20 yards.
At the other end McKenzie went close with a low shot which evaded the far post before Lewis Milne led a counter-attack that ended with a powerful drive from 25 yards that Alan Mannus did well to tip over the crossbar.
The visitors finally found their route to goal nine minutes after the restart.
Cowdenbeath failed to deal with a set-piece and were lucky to clear for a corner. Flynn pulled off an outstanding save to deny Steven Anderson, but the ball was knocked out to McCracken who drilled the ball through a ruck of bodies and into the net.
The following 10 minutes saw St Johnstone waste two great chances to settle the tie.
Hasselbaink's low drive from 15 yards was blocked by his own team-mate, a wandering Tade, then Anderson headed over from almost underneath the opposition crossbar.
It was through the aid of the referee's whistle that St Johnstone saw their passage assured.
Flynn was adjudged to have brought down Murray Davidson after the midfielder had raced onto Craig Beattie's pass and attempted to round the keeper - and MacLean despatched the resulting spot-kick into the bottom corner.
Tade rounded off the win three minutes from time when he broke the offside trap, rounded Flynn and rolled the ball into an empty net.
Cowdenbeath: Flynn, Cowan, Armstrong, Mbu (Cameron 64), Adamson, McKenzie, O'Brien, Milne, Brett, Miller (Navas 72), Coult (Thomas 80). Subs Not Used: Wight, Pyper.
Booked: Cameron, Flynn.
St Johnstone: Mannus, MacKay, McCracken, Anderson, Scobbie, Millar (Cregg 84), Murray Davidson, Craig, Hasselbaink (Beattie 69), MacLean (Caddis 78), Tade. Subs Not Used: Tuffey, Rodger.
Goals: McCracken 54, MacLean 76 pen, Tade 87.
Ref: John Beaton