The visitors will face St Mirren in Paisley in the next round thanks to goals from David McCracken, Steven MacLean and Gregory Tade.
Cowdenbeath's Central Park was able to host the tie at the fifth time of asking, and the Irn-Bru First Division side can be proud of a competitive performance, even if they were ultimately undone by the superiority of the visitors.
Having played out a pulsating 2-2 draw with Hearts in the Clydesdale Bank Premier League two days ago, St Johnstone boss Steve Lomas opted to shake things up 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.
The ring rusty part-timers submitted the running of the play to their full-time counterparts but created an effective wall between St Johnstone and their goal frame, with the early chances for the SPL side coming from long range.
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 out.
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.
Either side of the interval the visitors were wasteful in front of goal with Nigel Hasselbaink meekly passing into the arms of goalkeeper Thomas Flynn, before Tade rolled an effort from the edge of the box wide of the target.
The visitors finally found their route to goal in the 54th minute. With the imposing Joe Mbu off the park receiving treatment, Cowdenbeath failed to sufficiently deal with a set-piece and were lucky to clear for a corner.
Their luck ran out though - although Flynn pulled off an outstanding save to deny Steven Anderson, 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.
The visitors' wastefulness almost cost them immediately with McKenzie being sent free on the right - but once again Cowdenbeath saw a low effort inch just wide of the far post.
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 - staking a claim for a starting place in this Saturday's match at Aberdeen in the process.
Morton booked a fifth-round clash against Dundee after Peter Weatherson's hat-trick helped them thrash Turriff United 6-0.
The hosts' early forays saw Weatherson twice came close with his head inside 16 minutes. Team-mate Archibald Campbell fired over the bar soon after, while David O'Brien forced a save out of visiting goalkeeper Stephen Coutts.
Weatherson opened the scoring with his foot eight minutes before the break, powering home from the edge of the box to give Morton a deserved lead.
Turriff's woes deepened a minute before the interval as defender Ross Anderson fouled Michael Tidser inside the box, and the midfielder, who scored twice in Morton's 3-0 replay win over Albion, had no problems dispatching the penalty.
Weatherson turned provider for Tidser's second goal on 63 minutes, the latter drilling past Coutts from 25 yards.
Peter MacDonald then extended the home side's advantage with a headed goal from point-blank range. Weatherson's second and third of the evening swiftly followed, both goals coming within three minutes of each other.
His second strike was a cool close-range finish while he completed his treble by rifling home from 12 yards.
Hamilton will play Dunfermline in the last 16 after overcoming fellow First Division outfit Dumbarton 3-1 at the Bet Butler Stadium.
Alister Crawford put the visitors ahead with a stunning effort in the 24th minute, before Michael Devlin doubled Hamilton's advantage four minutes before the break.
Dumbarton's players rallied after the interval, though, setting up Chris Turner to head home from close range in the 57th minute, but Accies substitute Grant Gillespie struck from deep inside the penalty area with 75 minutes on the clock.
The Sons' chances of success suffered a further setback when Turner saw red three minutes later and Hamilton progressed to the next round.