DAVID Cameron panicked and got the Queen to help save the Union when an opinion poll just 11 days out from the independence referendum vote put the Yes campaign ahead for the first time, Lord Ashcroft's biography claims.

Ironically, the Prime Minister was staying at Balmoral when the headlines about the shock YouGov poll, putting the Yes camp ahead 51 points to 49, hit the news-stands.

As he left the royal estate in Aberdeenshire later that Sunday, the book, Call Me Dave, claims a worried Mr Cameron phoned Andrew Cooper, his pollster, who recalled: “He was very worried. It was the first time he was seriously contemplating: ‘S***, we might lose.’”

Lord Ashcroft’s book says, following the snapshot, that high-level discussions took place in London on whether or not the sovereign could somehow speak out against Scottish independence while remaining constitutionally neutral.

“Under a cloak of secrecy,” claims the biography, “the Cabinet Secretary, Sir Jeremy Heywood, and the Queen’s Private Secretary, Sir Christopher Geidt, held talks to work out how she might express her concerns in a suitably coded way.”

The Tory peer recounts that the result was a remark overheard after a Sunday service in Crathie Kirk, the small church members of the royal family attend when staying at Balmoral, when the Queen said: “I hope people will think very carefully about the future.”

Her eleventh hour anti-independence intervention was clear and, according to the book, delighted the No camp. Mr Cameron was “undoubtedly deeply grateful”, it notes.

The biography further claims: “In the final countdown to the big day, his usual sangfroid had deserted him and he’d started having sleepless nights. And he wasn’t the only one suffering. As stress levels mounted in the Cameron household, Samantha confided to friends that her hair was falling out.”

The biography makes clear the Tory leader was fully aware of the implications of a Yes vote, quoting one of Mr Cameron’s confidants as saying: “Funnily enough, it was less ‘we’re going to have to move out’ than the fact that, for the rest of his life, he’d be the prime minister who lost the United Kingdom. He was saying: ‘I’ll be remembered for this till the day I die.’”

The panic in Downing Street allegedly stretched to the PM even drawing up contingency plans should Mr Salmond and his colleagues have won the poll.

“In the days leading up to the referendum, Cameron became so agitated that he gathered his team to make contingency plans in the event of a Yes vote,” says the book.

“’They tried to draft a strategy for what they’d do, what they’d say the morning after the vote, who’d come out and give a statement,’” said a source. “’They got about three paragraphs in and it was not clear it would work.’”

However, Mr Cooper insisted the PM realised his political limitations. “I don’t think it’s fair to fault him, given how incredibly weak the stock of the Tories in Scotland is. It was very disciplined of him to acknowledge that; to be willing to be guided,” explained the pollster.

“He deferred to the advice of the Scots, he deferred to the people on the campaign and he deferred to the Labour people. He did exactly what he was advised to do when he was advised to do it,” he added.

The book notes that, according to a No 10 insider, the PM had to bite his tongue as his Labour predecessor Gordon Brown lectured him on how he should have run the referendum campaign.

“‘Gordon Brown couldn’t resist saying - I’m the saviour of the world and you take my advice,’ the source revealed. Cameron’s view, he says, was indulgent. ‘That’s Gordon,’ said the Prime Minister, wisely refusing to rise to the bait.”