Last year, I had a problem with my '91 318is. The check engine light came on and so I pulled over to look around a bit. No problem seen, so I got underway again and the check engine light went out, then came on again a few minutes later. After about 10 minutes the engine began to misfire and struggle very intermittently and I limped along with this for another ten blocks or so before it finally just died. I left the car on the side of the road overnight. The next day I came back and found that it fired up and ran fine, so i drove home. My mechanics could not pin down what had happened but theorized that it was a fuel problem and perhaps there were contaminants in the gas.
Fast forward to many months (but only 1000 miles) later and I'm going over a major bridge when the car just dies. Just as I coasted to a stop, I tried starting it with the key and it fired right away and ran fine for another mile, then died. After cooling off, it ran again and I got it home. This time, at the shop, they replaced the fuel pump, fuel pump relay and repaired some flaky wiring at the pump connector. The problems have not happened again.
I wonder if your problems are related to intermittent fuel pump operation, as mine were.