A Steve Howard strike saw Leicester through to the second round of the competition with a narrow win at the Walkers Stadium on Tuesday night.
But it could have been different had the Hatters not missed an easy chance inside the first minute when Anthony Pilkington blazed over from 10 yards after Carl Baker's clever through-ball had left him face-to-face with the keeper.
Stockport's bright start was tarnished when they were reduced to 10 men after 19 minutes. Matty McNeil was robbed by Howard on the edge of the box and then shown a straight red after he had hauled back the former Derby striker to deny him a clear run on goal.
City took the lead after 36 minutes when Howard slid the ball home from six yards after a cross from the left by Joe Mattock.
Leicester substitute Paul Dickov went close after 75 minutes when his close-range shot was saved by Stockport keeper Owain Fon Williams with his feet.
City were reduced to 10 men themselves after 85 minutes when Mattock was stretchered off following a challenge with Stockport substitute Peter Thompson.