Taking to the stage to thank the cast and crew, he sang a line from You'll Be Back - assuming the role of King George III, his sixth great-grandfather.
But he cut the song after singing "You say...", telling the audience: "That's definitely not going to happen".
Gesturing to the show's creator Lin-Manuel Miranda, Prince Harry added: "He did try, but I said 'no'."
The duke was accompanied by his wife Meghan, the Duchess of Sussex, at the musical, which raised £300,000 for Sentebale, the HIV charity he co-founded in 2006.
He thanked the audience for helping to "raise a huge amount of money to change the lives of thousands of children in Botswana and Lesotho and through that work that we're going to be doing now, we will be able to stop the generational... hand-down of the stigma of HIV".
Hamilton tells the story of US founding father Alexander Hamilton, and features King George III in a scene-stealing comic role - peacocking around the stage as he expresses disbelief and frustration at America's battle for independence.
Michael Jibson, who plays the role in the London production, was standing next to Prince Harry when he launched into his signature song, You'll Be Back.
Posting a clip of the performance on Twitter, he joked: "The moment I was upstaged".
Skip Twitter post by @mikejibson “Yes it is heavy!” @HamiltonWestEnd @HamiltonMusical #KG3 pic.twitter.com/mL8Y9FRcG6
Miranda told the audience how he had written King George's role during his honeymoon, adding: "Smash cut to 2018 I'm sitting next to his sixth-great grandson".
He later told reporters "you don't often get a direct descendent" to watch a show set in the 18th Century.
The duke and duchess of Sussex previously saw Hamilton earlier this year - while Meghan also watched the original Broadway production accompanied by actress Priyanka Chopra in 2016.
On Wednesday, the newlyweds sat among the audience in the royal circle at London's Victoria Palace Theatre, and went onstage to share their appreciation with the cast after the show ended.
Meghan told actors the energy on the night was "palpable", adding: "It was so engaging, every moment of it."
Prince Harry said: "That was absolutely incredible."