Lee Casswell was forced into a couple of changes with Ashley Woolliscroft and Tim Grice coming in for the unavailable Sam Hall and Peter Wright and he opted to make another giving Ricky Bridge his first start of the season in place of Matt Bell.
After a goalless first half The Wire took the lead on 57 minutes from the penalty spot.
Blues were soon level following a goalmouth scramble through Karl Charlton and he also netted the winner four minutes from time.
Town pick up £2000 for winning the tie and will be at home to the winners of the replay of the all Evo-Stik NPL First Division North tie between Farsley and Radcliffe Borough who drew 1-1 at Farsley today.
That match will take place at Harrison Park on Saturday 29th September.