The first attempt at the fifth-round tie had ended 1-1 at Fir Park and this clash at St Mirren Park was also a closely-fought encounter, with extra time and penalties – as predicted by Well boss Mark McGhee – looking likely.
But Mehmet’s strike with 85 minutes on the clock proved to be decisive, with a mouth-watering tie now awaiting them in the next round.
St Mirren manager Gus MacPherson made two changes from last week’s draw with Falkirk.
New signing Mo Camara was ineligible for the fifth-round clash and missed out along with the injured Steven Robb. Their absences paved the way for starting berths for both David Barron and Garry Brady.
Motherwell boss Mark McGhee made just one change after defeating local rivals Hamilton, with Marc Fitzpatrick given the nod ahead of Darren Smith.
There was plenty of effort but little in the way of clear-cut opportunities from either side in the opening spell.
St Mirren eventually carved out a chance when Barron broke down the left flank before picking out Steven Thomson at the back post but he failed to connect with the header.
The home side then won the first corner of the game and Brady did well to pick out Hugh Murray in the box but Graeme Smith was never troubled in the Motherwell goal as the midfielder nodded well wide.
Murray then had a go with a shot from 25 yards but, once again, was off target as he blasted over the crossbar.
Motherwell were gradually imposing themselves on the game and were not too far away when Cillian Sheridan whipped a teasing ball across the face of goal for David Clarkson.
He swiped at fresh air but the ball fell to Jim O’Brien on the edge of the box who unleashed a powerful shot which was hooked to safety by Jack Ross.
The Fir Park side then claimed John Potter handled a Sheridan shot but no penalty was forthcoming from referee Craig Thomson.
Impressive defending from Well prevented them from falling behind shortly after the restart when Dennis Wyness raced onto a head flick from Mehmet only to be denied the shot on goal by a great tackle from Mark Reynolds.
At the other end, O’Brien screwed wide of target under pressure from Barron but the tie was proving impossible to call and Ross then draw a decent save from Smith with a ferocious shot from distance.
Saints then squandered a great chance to take the lead when Paul Quinn’s poor clearance landed at the feet of Andy Dorman who teed up the shot for Mehmet as he bore down on goal.
All the striker had to do was stroke home from a few yards but somehow managed to bundle wide of the upright.
With extra time looking likely, Stephen Hughes tried desperately to chip the goalkeeper from the edge of the area but his effort dipped over the crossbar instead.
Craig Dargo had been thrown into the action for former Inverness strike partner Wyness and could have been the hero for St Mirren had his glancing header been on target but he nodded across the face of goal and past the post.
It was the home side who snatched victory with just five minutes to go when Dargo slipped a lovely pass through to Mehmet and he sent a low, angled drive past Smith into the bottom corner.