Hi there russellc2
Am curious to know if you got to the bottom of the issue?
I have an e30 that I converted to an M54 and have been having the same intermittent stalling issue that it sounds like you had.
Have replaced intake cam & crank sensors and no different, I've looked at everything and can't trace the fault.
Cheers