Sir Mo had fought desperately to claw back the deficit in the finishing straight but Edris held on to win in 13 minutes and 32.79 seconds.
Farah had won the 10,000m on the opening night - but it was not to be in the 5,000m. "I gave it all, I didn't have a single bit left at the end".
Paul Chelimo of the United States took bronze.
Ethiopian Muktar Edris crashed the Mo Farah party by beating the Brit to take 5,000m gold at the World Athletics Championships.
Virat Kohli reveals why India enforced the follow-on
Remember Lord's, remember Dharamsala against Australia, those are very important innings, the 90 against England in Mohali. India's commendable innings and 53-run win in the second Test was made easier by winning the toss and opting to bat first.
It was the great man's first defeat in a major championship race since the 2011 world 10,000 meters final when he also won silver - and, once again, it took dazzling speed to beat him over the last lap.
With nine laps to go Farah's fellow Brit Andrew Butchart briefly led with the pace slow as Edris and Cyrus Rutto made the moves to go up with Farah.
"They had the game plan: one of them was going to sacrifice themselves". Although Australian Patrick Tiernan hit the front on the 3,000m mark and tried to stretch the field, ...
Down the home straight all looked lost for Farah as he appeared blocked in until Kejelcha drifted out from the inside lane trying to block Chelimo, which allowed the Briton the chance to battle through on the inside. Last Friday night, he produced another bold if not ballsy display in the 10,000m, riding each wave of surge and counter surge with utter fearlessness: he very almost fell over himself too with 300m to run - yet held his nerve and ultimately devastating kick to win in 26:49.53, the fastest time in the world this year.