The UK prime minister has fended off calls to quit in a chastening House of Commons debate, but remains in dire political danger.