Match ends, Leicester City 3, Derby County 1.
Leicester secured a first home win of 2017 as Demarai Gray's superb solo goal sealed an extra-time victory over Derby in their FA Cup fourth-round replay.
Andy King headed the hosts, who made 10 changes, ahead after Gray's clever cross was nodded back across goal by Marc Albrighton.
Abdoul Camara's free-kick forced extra time for Championship Derby only for substitute Wilfred Ndidi to restore the Foxes' lead with a fantastic strike.
Gray sealed a deserved win with an angled finish after a fine run.
Premier League Leicester will now face League One Millwall in the last 16 on 18 February (15:00 GMT).
- 'Win can kick-start our season'
- Reaction from the King Power Stadium
- 5 live podcast: Nifty Shades of Gray
Smiles for Ranieri - at last
Claudio Ranieri has not had too much to cheer about lately as last season's champions have been plunged into a fight for Premier League survival.
Yet the Italian was all smiles and applauded home fans as they chanted his name around the King Power Stadium soon after King's opener.
Leicester, 16th in the table and one point above the relegation zone, face a battle to climb away from trouble but their first win since 7 January will at least provide them with some momentum.
A spirited Derby display - and a poor performance from the officials - made sure it was anything but a straightforward win.
The hosts should have won a first-half penalty when Ben Chilwell was sent sprawling inside the area by Richard Keogh but referee Mike Jones was not interested.
There was more controversy in the 85th minute when Derby keeper Jonathan Mitchell clearly handled outside his area but Leicester's Ahmed Musa was booked for protesting after Jones dismissed the home team's appeals.
Derby left to focus on play-offs
Although there was disappointment from Rams boss Steve McClaren, his team gave Leicester two tough games.
Derby led until four minutes from the end in the original game and forced Leicester into extra time on their own ground before running out of steam.
It might have been a different story had Ron-Robert Zieler not palmed away Jacob Butterfield's low drive on the stroke of half-time. By the time McClaren reached the dugout for the second half, his side were behind - King giving Leicester the lead in the opening minute of the second half.
The Rams responded well to falling behind. Camara had a free-kick beaten away before the Guinea international found the net with a 25-yard set-piece that deflected off Chilwell's thigh on its way into the net.
Derby's Max Lowe chested against his own post while attempting to guide the ball back to his keeper before two sublime finishes took the tie away from the visitors.
Ndidi fired home via the post from 25 yards then Gray, energetic and dynamic throughout, made it 3-1 after avoiding several challenges before his clinical finish allowed Leicester fans to celebrate a welcome victory.
All change - cup gets second billing
Both teams seemed to have their eyes on this weekend's games as they made 18 changes between them.
Musa was the only survivor from the Leicester side that started last weekend's match with Manchester United even though the Foxes are not in action again until Sunday.
Derby, despite bringing 5,000 travelling fans, made eight changes, as they also rested players to aid their play-off push.
"I didn't want to make eight changes. If the game was last night the team would have been totally different," said McClaren.
However, pundit and former Leicester midfielder Robbie Savage was critical of the number of changes made by both managers.
He said: "If Derby County were playing three Championship games in a week and chasing promotion would they put this team out? It's absolute nonsense. Play your best team."
Man of the match - Demarai Gray (Leicester City)

'This fresh air is good for us'
Leicester boss Claudio Ranieri: "Derby played good football and we won. This is what we needed and I wanted.
"We want to do well in all competitions. We want to go forward in the FA Cup. The Premier League is not so good but we have to stay in the Premier League. This fresh air is good for the players."
Derby County boss Steve McClaren: "There are some very tired players in the dressing room. It was always going to be hard work.
"We had a go and I can't fault the players. We ran out of steam in the end. We missed our opportunity in the first game."
What's next?
Sunday's Premier League game at fellow strugglers Swansea City (16:00 GMT) is a huge match for Leicester. Derby will look to strengthen their Championship play-off bid with a home victory over Bristol City (15:00 GMT) on Saturday.

Line-ups
Leicester
Formation 4-2-3-1
- 21Zieler
- 13Amartey
- 27Wasilewski
- 29Benalouane
- 3Chilwell
- 10King
- 24MendyBooked at 9minsSubstituted forNdidiat 90'minutes
- 11Albrighton
- 14KapustkaSubstituted forMahrezat 81'minutes
- 22Gray
- 7MusaBooked at 84minsSubstituted forSlimaniat 90'minutes
Substitutes
- 4Drinkwater
- 12Hamer
- 19Slimani
- 20Okazaki
- 25Ndidi
- 26Mahrez
- 28Fuchs
Derby
Formation 4-3-3
- 35Mitchell
- 2ChristieBooked at 5mins
- 6Keogh
- 5Shackell
- 25Lowe
- 18Butterfield
- 17de Sart
- 15JohnsonSubstituted forVydraat 53'minutes
- 20CamaraSubstituted forRussellat 74'minutes
- 22BlackmanSubstituted forNugentat 82'minutes
- 8Anya
Substitutes
- 1Carson
- 7Russell
- 10Ince
- 12Baird
- 16Pearce
- 23Vydra
- 28Nugent
- Referee:
- Mike Jones
- Attendance:
- 31,648
Match Stats
- Possession
- Home48%
- Away52%
- Shots
- Home13
- Away10
- Shots on Target
- Home6
- Away4
- Corners
- Home9
- Away7
- Fouls
- Home15
- Away17
Live Text
Post update
Post update
Second Half Extra Time ends, Leicester City 3, Derby County 1.
Post update
Corner, Derby County. Conceded by Daniel Amartey.
Post update
Foul by Jacob Butterfield (Derby County).
Post update
Andy King (Leicester City) wins a free kick in the defensive half.
Post update
Attempt missed. David Nugent (Derby County) header from the centre of the box misses to the left. Assisted by Cyrus Christie with a cross.
Post update
Corner, Derby County. Conceded by Wilfred Ndidi.
Post update
Corner, Derby County. Conceded by Ben Chilwell.
Goal!
Goal! Leicester City 3, Derby County 1. Demarai Gray (Leicester City) right footed shot from the centre of the box to the top right corner. Assisted by Marc Albrighton.
Post update
Attempt saved. Wilfred Ndidi (Leicester City) header from the right side of the six yard box is saved in the bottom right corner. Assisted by Riyad Mahrez with a cross.
Post update
Corner, Leicester City. Conceded by Johnny Russell.
Post update
Corner, Leicester City. Conceded by Jonathan Mitchell.
Post update
Attempt saved. Andy King (Leicester City) right footed shot from outside the box is saved in the bottom right corner. Assisted by Riyad Mahrez.
Post update
Second Half Extra Time begins Leicester City 2, Derby County 1.
Post update
First Half Extra Time ends, Leicester City 2, Derby County 1.
Post update
Corner, Derby County. Conceded by Yohan Benalouane.
Post update
Attempt missed. Johnny Russell (Derby County) header from the centre of the box misses to the left. Assisted by Cyrus Christie with a cross.
Post update
Foul by Islam Slimani (Leicester City).
Post update
Jason Shackell (Derby County) wins a free kick in the defensive half.
Post update
Foul by Wilfred Ndidi (Leicester City).
Comments
Join the conversation
Fact
Well played Leicester, now stay up and do the East Midlands proud!
Hopefully see you next season!
Hope you go up and we stay up too.
Looked a decent team now they found their true level again I.e championship
---------------
Says the fan of Englands 1961 top division champions.....................
Great play by Gray, as a Birmingham City fan I know just how much of a good player he is, can and will be at a higher level. Please give him more game time, once he gets up to speed he can change Leicesters fortunes.
Fair play to the Leicester squad players, showing hunger and desire to be part of their championship squad next season.
Derby are one of the leading championship teams, so at least your squad players are proving they can match the leading championship teams over 90 minutes.
-------
Says the fan of Englands 1961 top division champions.....................
As for the game, very disjointed to begin with, a referee who needs glasses and 2 bits of brilliance settled the game. Pleased for Ranieri, now will his so called stars step up having been shown how to by the 'B' team?