Gemstones from the crown jewels were hidden in a biscuit tin at Windsor Castle for safekeeping during World War Two, a BBC documentary will reveal.
It was buried below a secret exit on the orders of King George VI to prevent the jewels falling into Nazi hands.
Details of the mystery, unknown by the Queen, were discovered in letters from Sir Owen Morshead, the royal librarian, to Queen Mary, the mother of George VI.
The Queen was told the details for the first time by presenter Alastair Bruce.
The remarkable story was unearthed for the BBC One programme by Oliver Urquhart Irvine, the librarian, and assistant keeper of the Queen's Archives.
The stones, including the Black Prince's Ruby from the Imperial State Crown, were placed in the metal box and buried under a sally port, a secured entrance.
Sir Owen's documents describe how a hole was dug in chalk earth, which had to be covered to hide it from enemy bombers, and two chambers with steel doors created.
A trapdoor used to access the secret area at Windsor Castle, where the Queen spent her war years for safety, still exists today.
In the documentary, the Queen also talks about the amusing trials and tribulations of being head of state - from the perils of wearing a heavy crown, to her robes sticking to a thick carpet pile.