Chris Brown scored twice as Preston made it through to the third round of the Carling Cup with a hard-fought victory over Coca-Cola Championship rivals Leicester.
The visitors started brightly and claimed a deserved early lead through Nicky Adams.
But Brown's deflected strike pulled Preston level in an entertaining first half and the powerful forward sealed victory for the Lilywhites with a firm header 20 minutes after the break.
Leicester battled in vain for an equaliser in the closing stages, but they were unable to find a way past a spirited home defence.
The defeat is Leicester's first of the season, while Preston remain unbeaten in six league and cup games.
Both managers made numerous changes to their sides following weekend victories in the league, but Leicester soon settled and took the lead in the sixth minute.
Dany N'Guessan dispossessed Paul Parry in the box before cutting the ball back for Adams, who calmly lifted the ball into the top corner from around 12 yards.
The hosts equalised eight minutes later when Brown's driven shot deflected off veteran defender Chris Powell and looped into the net.
Gallagher saw a 25-yard shot whistle narrowly over the bar as Leicester looked to regain the lead, while at the other end Chris Weale had to make a fine stop to deny Brown a second goal as the striker produced an acrobatic scissor-kick from close range.
Leicester threatened again shortly before the half hour, but Darren Carter was on hand to clear off the line after an Adams corner had been flicked goalwards by Michael Morrison.
Brown and Nolan both saw efforts saved by visiting stopper Weale as a frantic opening period drew to a close, while Leicester forward Fryatt headed agonisingly wide in stoppage time after being picked out by Andy King's cross.
The opening stages of the second period proved far more sedate, although both sides saw penalty appeals rejected after Nolan and Fryatt tumbled in the area.
Preston sprung back to life shortly after the hour mark and stand-in skipper Chris Sedgwick shot narrowly wide before Weale produced another fine save to keep out Brown's header.
The hosts' dominance was soon rewarded as Brown met Nolan's left-wing cross with an accurate header that gave Weale no chance.
And although Leicester pressed for a leveller, they were unable to seriously test Lonergan in the remaining quarter of the game, with substitute Yann Kermorgant's wayward header the best of their efforts.