Sarah Ferguson shocked Queen Elizabeth before she got engaged to Prince Andrew. Years ago, Her Majesty learned that Fergie was still in communication with her former flame, Steve Wyatt.

In the book “The Queen and Di: The Untold Story,” royal expert Ingrid Seward said that the monarch found out about Ferguson and Wyatt’s friendship after the mom of two asked permission to bring the latter to Queen Mother’s 90th birthday party.

The request did not only shock Her Majesty; it also encouraged her to call out her former daughter-in-law.

“There was only so much even the Queen was prepared to tolerate, however, and she finally felt moved to suggest to her daughter-in-law that Wyatt was not ‘quite the sort of person you should be encouraging.’ It was the end of the affair. It was also the beginning of the end for Fergie,” Seward said.

But despite the shocking exchange between the two female royals, Ferguson still pushed through with her and Prince Andrew’s wedding. The Queen gave the royal couple her blessing without knowing that the Duke of York had already proposed to Ferguson three weeks earlier.

Fergie and the Queen also had a wonderful relationship while Princess Beatrice’s mom was married to Prince Andrew. But everything changed after she became involved with another man after separating from the father of her daughters.

In the documentary “Chasing the Royals: The Media and the Monarchy,” royal correspondent James Whitaker said that the Queen was very upset when she saw a photo Ferguson hanging out with John Bryan. The latter is also sucking Ferguson’s toe in the snap.

“It happened in front of the whole family at the Queen’s country residence in Scotland. She was late into breakfast and everybody had got a copy of the Daily Mirror. As she walked into the room, they all stuffed it under their Times and Telegraphs and that sort of thing… She knew the game was up the second she walked into the room,” he said.

Queen Mother, Prince Andrew, Prince Edward, Sarah Ferguson, Princess Diana, Prince Charles and Queen Elizabeth II Queen Mother, Queen Elizabeth II, Prince Andrew, Sarah Ferguson, Lord Linley, Prince Edward, Prince Charles and Princess Diana outside Clarence House on Aug. 4, 1989. Photo: Getty Images/Johnny Eggitt