Steve Morison stepped off the bench to score the winner two minutes from time as Millwall came from behind to beat Gillingham 2-1 in the Checkatrade Trophy on Tuesday night.
Former Lion Josh Wright had given the visitors an early lead before Fred Onyedinma nodded home an equaliser in first-half stoppage time.
Neil Harris made seven changes from the team which started Saturday's defeat to Walsall, one of which was a senior debut for young right-back James Brown in place of Mahlon Romeo, who was unavailable because of international duty. Fellow Academy graduate Noah Chesmain also came in for a start as the Lions boss set-up his team in a 4-3-3 formation.
The first meaningful chance of the game fell to Gillingham after six minutes, but Jake Hessenthaler's volley from a Ryan Jackson cross went over Tom King's bar.
The travelling fans only had to wait a further 11 minutes before their side took the lead when, following a corner, ex-Lions midfielder Wright was quickest to react to a loose ball and turned it home in off the post from inside the six-yard box.
Millwall mounted a near immediate response when Ben Thompson's cross towards Gregg Wylde was cleared by Jackson but only as far as Chesmain, whose effort from distance edged over the bar.
The Gills threatened to extend their lead shortly after the half hour mark when Rory Donnelly broke clear and saw a cross parried by King but with Elliott List lurking, The Lions managed to scramble the ball away.
The hosts had an opportunity to level moments before the interval when Shaun Williams flicked the ball on to Lee Gregory, who tried to squeeze it past Stuart Nelson at full stretch but the keeper managed to gather.
But Millwall did manage to level things up before half-time thanks to Onyedinma, who headed home his second goal in four days from close range after Gills stopper Nelson failed to adequately deal with a cross into the box.
Harris replaced Chesmain and Wylde with Joe Martin and Morison for the start of the second-half, and the latter was involved in an early move which led to Gregory shooting wide of Nelson's left-hand post.
Young debutant Brown was forced off with an unfortunate injury after 54 minutes and his replacement, Jimmy Abdou, playing at right-back, almost caught out Nelson with a cross which the Gills keeper had to gather under his bar after backpeddling.
Millwall had a good chance to go in front on the hour mark when Morison's cross was left by Gregory for Thompson, who failed to connect cleanly with his effort on goal before Calum Butcher turned it wide from inside the area.
The two sides began to cancel each other out as the game wore on but Gillingham did spurn an opportunity to score a second with eight minutes to go when List volleyed over after good work from Hessenthaler down the left.
But with the match heading for a penalty shoot out, Morison produced a moment of real quality to give his side an 88th-minute lead. The experienced front man showed quicker feet than his marker to win possession and tee himself up before firing low past Nelson to earn The Lions all three points in Southern Section Group H.
Millwall: King, Craig, Williams, Thompson, Gregory, Onyedinma, Wylde (Morison, 46'), Nelson, Butcher, Brown (Abdou, 54'), Chesmain (Martin, 46'). Subs not used: Archer, Twardek, Philpot, Rooney
Goalscorers: Onyedinma 45', Morison 88'
Bookings: Butcher, Gregory, Chesmain, Williams, Morison
Gillingham: Nelson, Jackson (Knott, 71'), Herd (Byrne, 61'), Ehmer, Oshilaja, Hessenthaler, Donnelly, Osadebe, Park, List, Wright. Subs not used: Hadler, Oldaker, Dickenson, Chapman, O'Mara
Goalscorers: Wright 17'
Bookings: Jackson, List
Referee: Christopher Sarginson
Attendance: 2,240 (143)