Had the Crown Prince wanted to get rid of Khashoggi there are any number of discreet ways to do it. Assassinating him inside a Saudi embassy is definitely not one of them.
In fact, killing him in the embassy was guaranteed to generate an international incident and deliver a major setback to MbS. Which I suspect was the intended goal, since MbS is not a fool and would have known better.
My suspicion is that this was ordered by someone else in the Saudi royal family whose intention is to discredit MbS and if possible replace him.
It feels that way