The lost painting by celebrated Scottish artist Allan Ramsay depicts Charles Edward Stuart in Edinburgh the year before his crushing defeat at the Battle of Culloden.
It was discovered by art historian Dr Bendor Grosvenor in the collection of the Earls of Wemyss at Gosford House, just outside Edinburgh.
The portrait shows Charles - known as The Young Pretender - in 1745, the year he became the last man to lead a Scottish army into England.
Dr Grosvenor revealed in 2009 that a portrait at the Scottish National Portrait Gallery was not in fact of Charles but his brother Henry.
The discovery led the historian to retrace Charles's journey in the hope of tracking down a long-lost painting of the prince.
He said: "Bonnie Prince Charlie is one of my heroes, and I always felt bad about debunking what used to be his most famous portrait.
"So I'm delighted to have found the best possible replacement - a portrait painted from life on the eve of his invasion of England."
A key clue in the quest was the discovery of a letter summoning Ramsay to paint Charles's portrait at Edinburgh's Palace of Holyrood in October 1745.
An old black and white photograph of a painting of Charles which bore all the stylistic hallmarks of Ramsay's work was then found in the National Portrait Gallery archive in London.
Dr Duncan Thomson, former director of the Scottish National Portrait Gallery and an expert on Ramsay's work, has confirmed the attribution.
He said: "This portrait brings the prince back to life in a way I'd never thought imaginable. It's hard to overstate the importance of finding a portrait of the prince painted in Scotland, by a Scottish artist."
Charles Edward Stuart was the grandson of the exiled Stuart King James II. He landed in Scotland in 1745 at the age of 24, determined to regain the throne.
Despite bringing his Highland army as far south as Derby, the furthest any Scottish army had reached into England, the rebellion ended in defeat at the Battle of Culloden in 1746.
The discovery of the painting is the subject of a BBC Scotland Culture Show special on BBC2 at 9pm tomorrow.