Goals from Mark Noble and Mo Diame had twice brought Sam Allardyce's team back into the game before the 17-year-old's winner in stoppage time
The 17-year-old tapped home in the 90th minute on Saturday after good work from Elliot Lee to ensure Sam Allardyce's men recorded their second close-season success.
West Ham twice came from behind before substitute Burke's late heroics, Mark Noble and Mohamed Diame cancelling out goals from Stefano Okaka and Eder.
The home side had the best of the opening stages and Nolan forced a good save from Sampdoria goalkeeper Angelo da Costa in the third minute.
Nolan pounced on a poor clearance and produced an acrobatic overhead kick that Da Costa did well to keep out.
But it was the Serie A side who broke the deadlock in the 16th minute when Eder played in former Fulham loanee Okaka, who did well to hold off defender James Collins and slot past Adrian.
The Premier League side hit back from the penalty spot right on the stroke of half-time after Lorenzo De Silvestri tripped Dan Potts, with Noble making no mistake from 12 yards.
Sampdoria retook the lead on the hour mark when Brazilian Eder excellently created space between West Ham defenders Collins and James Tomkins and stroked the ball into the net.
But West Ham equalised again in the 77th minute when Diame ran past two Sampdoria defenders and finished confidently past Da Costa.
Allardyce's side could have taken the lead two minutes later when Stewart Downing's header from a Ricardo Vaz Te cross rebounded off the bar, but it was Burke's late finish that secured the win for West Ham.