Match ends, Millwall 2, Charlton Athletic 1.
Jos Hooiveld's late winner earned relegation-threatened Millwall three points at home to 10-man Charlton.
Chris Solly was sent off for handball, with the referee also awarding a penalty, but Lee Gregory's effort was saved by Charlton's Stephen Henderson.
The away side led through Alou Diarra, before second-half substitute Magaye Gueye levelled with a low drive.
Centre-back Hooiveld poked home with three minutes left to narrow the gap on 21st-placed Rotherham to four points.
Rotherham were beaten 2-1 at Birmingham City, allowing Neil Harris' Millwall to edge closer to safety in 22nd place with a first home win since October.
The interim Lions boss now has six games to keep his side up, with one of those coming at home to fellow strugglers Wigan Athletic on 14 April.
Charlton stay 11th, 14 points outside the play-off places and 18 points clear of the relegation zone.
It looked as if Guy Luzon's side would secure an unlikely win at The Den, having entered the closing stages of the match in the lead, despite having had Solly sent off with just 28 minutes played.
The centre-back was adjudged to have blocked the ball on the line with his hand, but Millwall were denied by Henderson from the resultant penalty.
Charlton then led when former West Ham midfielder Diarra turned in Morgan Fox's cross, but Gueye scored one before providing the assist for Hooiveld as the home side struck twice in the final 11 minutes.
Millwall caretaker manager Neil Harris: "To have done that against our local rivals in such an important game is huge. The home form is key to our survival.
"I thought we were excellent. When you go 1-0 down it's a kick in the teeth and you think it might not be your day, but the fans stuck with the team. It was phenomenal.
"I would have been gutted if we didn't win the game, but for the whole club the result is special and now we have the momentum."
Charlton manager Guy Luzon: "My players gave everything, especially with 10 men, but football is like this sometimes and I thought we were excellent in the second half.
"The red card changed our style of play. We like to move the ball and play attacking football, but we did the most we could after the break and scored a great goal.
"At 1-1, Simon Church had a great chance to make it 2-1 but unfortunately in the next attack they score the winning goal."
- 5HooiveldBooked at 36mins
- 21HardingSubstituted forMaierhoferat 69'minutes
- 15UpsonSubstituted forBaileyat 76'minutes
- 6WilliamsBooked at 71mins
- 26AbdouSubstituted forGueyeat 59'minutes
- 11WoolfordBooked at 77mins
- 20SollyBooked at 28mins
- 7Berg Gudmundsson
- 9EaglesSubstituted forBikey Amougouat 33'minutes
- 14VetokeleSubstituted forBulotat 72'minutes
- 32WattSubstituted forChurchat 78'minutes
- 6Bikey Amougou
- Mick Russell
- Shots on Target
Second Half ends, Millwall 2, Charlton Athletic 1.
Hand ball by Aiden O'Brien (Millwall).
Attempt missed. Shaun Williams (Millwall) left footed shot from outside the box misses to the left.
Attempt missed. Stephen Henderson (Charlton Athletic) header from the centre of the box is just a bit too high. Assisted by Johann Berg Gudmundsson with a cross following a corner.
Corner, Charlton Athletic. Conceded by Nicky Bailey.
Corner, Millwall. Conceded by Roger Johnson.
Goal! Millwall 2, Charlton Athletic 1. Jos Hooiveld (Millwall) left footed shot from very close range to the centre of the goal. Assisted by Magaye Gueye following a corner.
Attempt blocked. Magaye Gueye (Millwall) left footed shot from the left side of the box is blocked. Assisted by Nicky Bailey.
Corner, Millwall. Conceded by Alou Diarra.
Attempt blocked. Stefan Maierhofer (Millwall) header from the centre of the box is blocked. Assisted by Lee Gregory with a cross.
Attempt missed. Simon Church (Charlton Athletic) header from very close range misses to the right. Assisted by Frédéric Bulot with a cross.
Goal! Millwall 1, Charlton Athletic 1. Magaye Gueye (Millwall) left footed shot from the left side of the box to the bottom right corner.
Attempt blocked. Shaun Williams (Millwall) left footed shot from outside the box is blocked.
Substitution, Charlton Athletic. Simon Church replaces Tony Watt.
Martyn Woolford (Millwall) is shown the yellow card for a bad foul.
Foul by Martyn Woolford (Millwall).
Jordan Cousins (Charlton Athletic) wins a free kick on the right wing.
Substitution, Millwall. Nicky Bailey replaces Ed Upson.
Attempt blocked. Ed Upson (Millwall) right footed shot from outside the box is blocked. Assisted by Magaye Gueye.