A secret opinion poll just days before the 2014 Scottish independence referendum caused "panic" among No campaigners, a new documentary claims.
It said the internal poll carried out for the UK government put the Yes campaign four percentage points ahead.
Also in the documentary, veteran BBC broadcaster Allan Little criticises the attitudes of some of his London-based colleagues towards independence.
BBC boss Ken MacQuarrie said the corporation did its job professionally.
'Something was shifting'
The third part of the documentary series Yes/No: Inside the Indyref, to be shown on the BBC Scotland channel on Tuesday, looks at the last days of the 2014 campaign.
The No campaign eventually won the referendum by 55% to 45%.
Better Together, which was fighting for Scotland to remain part of the UK, had started the two-and-half year campaign as much as 20 points ahead in opinion polls.
But as the 18 September polling day drew closer, the result was too close to call.
Douglas Alexander, who was a Labour MP and senior Better Together figure, tells the programme "something was shifting".
According to Andrew Dunlop, special adviser to Prime Minster David Cameron, the government was so concerned it conducted its own daily tracking poll.
On Friday 5 September, less than two weeks before polling day, its secret results showed the lead for the Yes campaign was four points.
It came the same day as a YouGov poll was received by the Sunday Times showing Yes were leading the polls for the first time by 51%-49%.
There was "overwhelming panic" from everyone involved with Better Together, according to Ruth Davidson, leader of the Scottish Conservatives.
Despite Ms Davidson advising everyone to "hold your effing nerve", plans were made at the highest levels to completely change the approach of the campaign.
George Osborne, who was chancellor at the time, went on Andrew Marr's Sunday morning TV programme to announce a plan of action to give more powers to Scotland over tax, spending and welfare.
The documentary also talks to Nick Robinson, who was the BBC's political editor at the time.
He had a high-profile dispute with Alex Salmond, who was Scotland's first minister and leader of the SNP at the time, over his reporting of a plan by the Royal Bank of Scotland to move its headquarters to England in the event of a Yes vote.
The pair engaged in a lengthy exchange during a press conference and Robinson claimed in his news story that Mr Salmond "didn't answer" the question.
Robinson told the Yes/No programme: "In the end it was a subjective view as to whether he did or didn't properly answer the question.
"It wasn't a clever script line. In truth, given the chance, I would have rewritten it."
BBC broadcaster Allan Little, who grew up in south-west Scotland and had worked for the corporation for more than 30 years at the time of the referendum, told the programme he was surprised how little some people in London knew about what had brought Scotland to that moment.
Little, who was the BBC's Referendum Correspondent, said: "I know how hard my colleagues in London work at trying to get it right.
"It's in the DNA when you are a BBC journalist.
"I'm not cynical about that but I was quite surprised by some of my colleagues failing to understand their own assumption that the Yes side was wrong."
He added that some colleagues thought "that our responsibility was to produce a series of pieces to demonstrate how foolish it would be to vote Yes".
Ken MacQuarrie, who was the director of BBC Scotland, told the programme BBC journalists "left behind" their own opinions when reporting.
He said: "People were doing a professional job as far as was possible in every situation that they came across."