Neil Baker had to change his starting line-up with Mike Calveley recalled by Port Vale and he opted to start Sam Grimshaw against his former club.
Leek went ahead in the 10th minute when Tim Grice intercepted a pass in the Glossop back-line and despatched the ball past Paul Phillips in the home goal.
The lead lasted less than 90 seconds however as Zeph Thomas equalised with a close range effort.
The Hillmen took the lead in the 32nd minute when Niall Maguire lost the ball near the halfway line and Thomas was played in with plenty of time to pick his spot and score past Ben Chapman.
Three minutes later the scores were level again when Grice wide on the right played the ball across to Dan Trickett-Smith who beat his man and blasted the ball past Phillips (pictured, above).
Early in the second half Blues had a scare when the ball bounced on the top of the crossbar and soon after another shot skimmed the roof of the net.
On 68 minutes Trickett-Smith saw his fierce free-kick punched away by Phillips before the Hillmen took the lead in controversial fashion.
A high hopeful ball was hoisted in from the left wing and as Chapman rose to collect, he was blatantly barged into the back of the net by Ben Deegan.
The ball struck the crossbar and as it dropped Deegan back-heeled it into the net where Chapman was lying on the ground.
Seven minutes later it was 4-2 when a deep cross from the right was headed in at the far post by Courtney Meppen-Walter,
Baker brought on Jordan Johnson and in the 85th minute, keeper Phillips was adjudged to have brought him down as he tried to go around him when clear. Grice converted the spot-kick to make it 4-3.
However, despite five minutes of added time, Leek were unable to create a clear-cut chance to level the game and Glossop held out to claim a place in the Third Qualifying Round.
View the match photos here.
Team: Chapman, Green, Kearns (Johnson, 85), Grocott, Lycett, Chadwick, Maguire, Grimshaw, Grice , Trickett-Smith, Stevenson
Unused subs: Shelley, Hammond, Wyatt
Updated 22:52 - 14 Nov 2017 by Stevie R