Adam Proudlock scored two goals in the second half of extra time to seal victory for Sheffield Wednesday.
Stockport went ahead on eight minutes with a strike from Danny Boshell but Lee Peacock equalised soon after.
Richie Partridge fired in for Wednesday from 20 yards in the first period of extra time only for Adam Le Fondre to hook in for a equaliser a minute after.
Proudlock pounced on a Ashley Williams mistake to put his side ahead before adding a second in the dying seconds.
Stockport: Spencer, Greenwood (Briggs 83), Clare, Ashley Williams, Robinson, Hamshaw (Coward 118), Wolski, Boshell, Singh, Easter, Le Fondre.
Subs Not Used: Duncan, Dje, Allen.
Booked: Boshell, Wolski, Easter.
Goals: Boshell 8, Le Fondre 108.
Sheff Wed: Lucas, Simek, Diallo, Coughlan (Wood 90), Hills, Partridge, Whelan, O'Brien, Brunt (Rocastle 94), Peacock, Graham (Proudlock 68).
Subs Not Used: Adamson, Lee.
Booked: Simek, Whelan.
Goals: Peacock 15, Partridge 107, Proudlock 116, 120.
After Extra Time.
Ref: C Webster (Tyne & Wear).