Neil Harris broke Millwall's all-time scoring record to help his side into the fourth round of the FA Cup.
The veteran striker fired his side into a 2-1 lead in the 54th minute against Crewe. It was his 112th career goal for the Lions and saw him pass Teddy Sheringham's previous tally.
But it did not guarantee the third placed side in League One their place in the next round as Crewe fought back within three minutes when a Billy Jones free-kick flicked on by Shaun Miller took a ricochet off Alan Dunne and ended up in the net.
The quick exchange of goals were a feature of an entertaining tie in new manager Gudjon Thordarson's first game in front of his home support.
Teenager Luke Murphy dispatched a seventh minute volley over keeper David Forde to give the Railwaymen the lead.
But when Scott Barron's cross come shot a minute later swerved out of Steve Collis' reach the home keeper, who had been recalled for the tie, was left with egg on his face when the ball carried over the line.
Millwall were in the ascendancy for much of the first-half, testing Collis with long-range efforts after his early clanger.
But Miller may have reacted quicker to restore Crewe's lead in the 32nd minute when a Colin Daniel cross crept through at the near post.
After Dunne's own goal Lewis Grabban seemed determined to ensure the game did not drift into extra time.
The winger came close with a 25-yard toe-poke and then almost caught out Collis after bursting through the middle, but this time the keeper applied a firm hand to turn the ball over.
But he was nowhere to be seen when Zak Whitbread rose highest to head Marc Laird's 85th minute corner into the bottom corner for the winner.