Hmmm, this is curious 95BMW...
It really could be many things I think. It could be a camshaft sensor, although I'm not sure if the E34 has that, but my car does and this can cause the car to stall.
I would check the idle control valve too, although that wouldn't necessarily prevent it from dying on you... I have also heard of cars with blocked cats which can cause a similar problem to what you're experiencing.
Can you start the car again straight after it stops? Usually, if the issue is sort of self-correcting like that then it is most likely an electrical issue.
I'm really not too sure though. Perhaps some of the other boys can help you out better than I can. Good luck though and let us know how you get on.