The striker played a huge part in the opener when his header hit the post and bounced off goalkeeper David Crawford into the back of the net.
The Second Division side pulled a goal back through Mark Brown but Mehmet netted either side of the interval to ensure there was no cup shock at St Mirren Park.
The Buddies made several changes from last week's win over Kilmarnock, with Chris Innes - who came off the bench to net a late winner against Killie - added to the starting line-up, along with Alan Johnson, Steven Thomson and Steven Robb.
Skipper John Potter was out with a hamstring strain, while Michael Higdon - back from suspension - was named among the substitutes.
This was Alloa's first trip to St Mirren Park and they would have been hopeful of an upset after thrashing Saints 4-0 when the two sides last met in a Division One clash in May 2003.
St Mirren tried to put their visitors under pressure early on and Johnson tried his luck from distance but he blasted well over and Crawford was untroubled in the Alloa goal.
Allan Maitland's men carved out a couple of decent chances of their own. Andy Scott's corner picked out Chris Townsley at the back post but his header was hooked to safety by the Saints defence.
John Grant then unleashed a long-range effort which appeared to be heading for the top corner but Paul Gallacher did well to gather.
At the other end, only last-gasp defending prevented Alloa from falling behind when Scott blocked on the line with his shoulder to prevent Stephen McGinn's shot finding the back of the net.
Alloa suffered a setback when Saints surged into the lead with 26 minutes gone.
A Jack Ross cross from the right found Mehmet 10 yards out and he bulleted a header towards goal, which smacked the inside of the post and bounced off the goalkeeper before crossing the line.
Far from having the stuffing knocked out of them, the plucky Wasps were back on level terms after 34 minutes when Brown connected with Mark Gilhaney's cross and rifled a right-foot volley into the back of the net.
However, Saints reclaimed the lead on the stroke of half-time when Craig Dargo delivered an inviting cross for Mehmet to lash home from just inside the box.
Alloa again demonstrated their determination when they emerged for the restart in search of another goal after conceding so late in the first half.
And they were not too far away when Gilhaney dispatched a powerful effort that was blocked by Gallacher a few minutes into the second half.
Stuart Noble then found himself through on goal with only the goalkeeper to beat but the offside flag was already raised before he even had the chance to shoot.
Gus MacPherson's men could have killed off the tie when Robb embarked on a decent run before finding Mehmet out on the left. He cut inside before having a shot at goal but his effort was blocked by the Alloa defence.
The Scottish Football League side were refusing to give up just yet and Gallacher was called into action to smother a low, angled drive from Scott.
Mehmet did have the final say with just three minutes to go when he met a Hugh Murray ball before rounding the goalkeeper and slotting home to ensure there would be no late comeback from their opponents.
The striker then forced a great save from Crawford in the final seconds but Saints' passage was already secure by then anyway.