Leighton McIntosh scored twice as Wrexham beat St Mirren Colts to reach the Tunnock’s Caramel Wafer Cup quarter-finals.
After a goalless first half, Devonte Redmond scored within seconds of the restart and McIntosh doubled the lead from the spot.
Jay Henderson pulled one back for the Young Buddies, but McIntosh’s second of the game and Ben Tollitt’s late strike earned Dean Keates the first win of his second spell as manager.
Keates made 11 changes to the team which faced Harrogate in mid-week, including a first start of the season for fit-again Rob Lainton in goal.
Youth team captain Bobby Beaumont and midfielder Mathew Jones made their first Wrexham starts meanwhile, after coming off the bench in the previous round.
Doug Tharme led the team out, while Max Cleworth and Jake Bickerstaff – as with the previous round – were in the starting line-up.
And Bickerstaff had the first chance of the half, meeting Tharme’s right-wing cross at the near post and backheeling just wide.
Bickerstaff then missed Akil Wright’s low cross on 14 minutes, but Redmond followed in and his low shot was blocked well by Scott Glover.
At the other end, Cameron MacPherson’s left-footed shot deflected onto the bar and clear on 19 minutes after McIntosh got an important touch to it.
As the Young Buddies grew in confidence, more chances arrived – Joshua Jack and Conor McBrearty both shot straight at Lainton from distance just after the half-hour.
MacPherson – match-winner in the previous round and one of the more experienced players – then fired just wide on 34 minutes.
Cameron Breadner then pounced on Michael Chambers’ poor touch on 40 minutes, but Lainton parried his rising strike clear.
The half ended with the Young Buddies on top, but both sides went in goalless at the break.
Wrexham flew out of the blocks after the break, however – Tollitt flying past Matthew Grant and pulling the ball back for Redmond just 20 seconds into the second-half.
Tollitt then cut inside onto this right foot on 53 minutes but his rising right-footed shot flew just over the bar from 20 yards.
The Dragons doubled the lead on 55 minutes though – MacPherson tripped Tollitt in the area and McIntosh sent Dean Lyness the wrong way from the spot.
St Mirren responded well, however, and McBrearty scooped a shot over from a tight angle on 57 minutes after cutting inside Tharme.
And the Young Buddies pulled one back on 68 minutes – substitute Lewis Jamieson squaring for Jay Henderson to score from a fast-paced counter-attack.
McIntosh restored the two-goal advantage on 73 minutes – capping Wrexham’s own counter-attack when he slid in to beat Lyness to Redmond’s lofted cross.
Keates then handed a first-team debut to Kyle Robinson-Murray, who replaced Jake Bickerstaff in the 78th minute.
Tollitt cut inside from the opposite flank moments after play restarted, but his right-footed shot was deflected and eventually blocked.
Henderson drove forward from inside his own half in the 79th minute, getting into the penalty area and shooting across goal, but Lainton parried clear.
The game was becoming stretched, and Akil Wright’s header was cleared off the line on 80 minutes, and an offside flag denied McIntosh a spectacular overhead kick for his hat-trick moments later.
Tollitt wrapped up victory in the 89th minute, however – crowning an intricate passing move involving Mat Jones, with a good low finish from close-range.
There was still time for Calum Huxley to replace Tollitt and make his first Wrexham appearance, before the full-time whistle confirmed the Dragons’ quarter-final place.
Wrexham: (4-4-2 Diamond): Lainton; Tharme, Cleworth, Chambers, Beaumont; Jones; Wright, Redmond; Tollitt (Huxley 90); Bickerstaff (Robinson-Murray 78), McIntosh.
Subs: Szczepaniak, Humphreys, Parry, Nash, S Williams.
St Mirren Colts: (4-3-3): Lyness; Grant (L.Jamieson 59), Glover, McAllister, Erhahon; McBrearty, MacPherson, Gray; Henderson, Jack (McCaw 86), Breadner (Reilly 82).
Subs: Law, Walker, Girvan, Frew.
Referee: Ray Matthews (Ireland)
Wrexham: Redmond (29, foul)
St Mirren: MacPherson (55, foul)