Shaun Cummings was the League One side’s hero at The Den, scoring in the last minute as Neil Harris’ men overcame the dismissal of Jake Cooper to secure a spot in the quarter-finals.
The Foxes are hovering just above the Premier League relegation zone in a meek defence of their title and Saturday’s loss will ensure speculation over Ranieri’s future intensifies.
They made a positive start against the Lions, Demarai Gray curling an early effort narrowly wide, while Jordan Archer produced a stunning save to keep out Shinji Okazaki’s near-post header.
Ahmed Musa also sent a powerful strike just over the crossbar as Leicester’s promising first-half showing failed to yield reward.
When Cooper was handed a second yellow card seven minutes after the interval it looked as though the path to the last eight was opening up for Leicester.
Jamie Vardy was introduced 18 minutes from time in a bid to force the issue, while the best chance fell to Okazaki inside the six-yard box, the Japan international dallying and Archer capitalising to block his prodded attempt.
A replay for the third-tier side would have been just reward for their resilience, but Cummings had other plans and calmly picked out the bottom-left corner after collecting Lee Gregory’s pass.
Sadly the understandably exuberant celebrations of the home fans were somewhat marred by a pitch invasion that saw some Millwall supporters approach the away end.
Key Opta stats: - Millwall beat the reigning English top-flight champions in a competitive match for the first time since a 3-1 win over Huddersfield Town in the FA Cup in 1927. - It’s the first time since 1936/37 that the Lions have eliminated three top-flight sides in the same FA Cup campaign. - Jake Cooper received just his second career red card, having also been sent off for Reading against Crystal Palace in March 2016. - Leicester’s tally of 12 shots in the first half was their most in the first 45 minutes of any game this season - however, only one of these was on target. - Leicester City failed to score for the seventh time in 10 competitive games in 2017. - It was the Foxes’ first FA Cup defeat to a side in the third tier or lower since they were knocked out by Wycombe Wanderers in March 2001.