Dettori rode the Dean Ivory-trained horse to the far rail before leading all the way in the 26-runner race.
The seven-year-old eventually won by three-quarters of a length from Aeolus in second with Upstaging third.
"I did not expect it, but Dean was very sweet on him. I bagged the rail, and he kept on galloping," said Dettori.
BBC horse racing correspondent Cornelius Lysaght
In a big field like this, there is masses of 'trouble in running', so if your horse has the speed to be right up there throughout, life is a lot easier.
And so it was with Lancelot Du Lac, who, apart from a few strides late on when the cavalry appeared to be coming, was always in control.
The horse, a significant part of Ivory's small but not unsuccessful team, is an all-weather circuit regular, hence he was a long-shot despite his jockey; before this, he had not won a race on turf for nearly four years.
Frankie Dettori took a surprise victory on the 25-1 shot Lancelot Du Lac in the Stewards' Cup on the fifth and final day of flat racing's Goodwood Festival.