Farah ended his track career this year having won 10 global gold medals, winning the 10,000m in London but missing out yet another distance double when he finished second in the 5000m.
Joshua had been a huge 1/10 favourite to win the award and become the first boxer since Joe Calzaghe to do so.
But Farah, who was not in attendance on the night, was the surprise 33/1 winner ahead of three-time Superbike World Championship winner Jonathan Rea and para-athlete Jonnie Peacock.
“Mate, I didn’t see that coming. I honestly thought I wasn’t going to win it,” Farah later told BBC Radio 5 Live.
“We have such amazing sports in the UK with people doing great Lewis Hamilton, Jonnie Peacock and Anthony Joshua.
“I thought my closest would be after London 2012. I guess anything can happen.
“It means a lot to win this. I am very surprised to win tonight and I’m just sorry I can’t be there to celebrate.
“It’s something special, pretty amazing. I watched BBC Sports Personality every year.
“Having come so close in 2012, I thought ‘mate, this thing is so hard to win’.
“Tomorrow, I’ve got a couple of runs and my coach, Gary, is coming to see me.
“I hate the cold – I don’t mind the distance!”
The result appeared to catch almost everyone by surprise as Farah clasped his face before the video feed connecting him to the ceremony cut out almost immediately.
His earlier interview had also been marred by technical difficulties, this time the overactivity of his young son Hussein.
The BBC’s gala evening had earlier celebrated 12 months of British sporting success at the Echo Arena in Liverpool, where nearly 11,000 people broke out into a spontaneous standing ovation when Bradley Lowery, the six-year-old Sunderland fan who lost a long battle with cancer in July, was posthumously honoured with the Helen Rollason Award for achievement in the face of adversity.
Roger Federer was also recognised with his fourth BBC Overseas Sports Personality of the Year in the same year that he sealed an eighth Wimbledon title.
But Federer was one of many athletes who failed to turn up for the occasion, with Hamilton, Johanna Konta, Farah and Chris Froome all opting instead to perform video interviews.
The BBC would have been thankful if the public played their part and voted for Joshua, one of the few high-profile nominees to turn up.