I have had something similar happen to me recently.
The car is tuned. Auto 2.0
Pulling into a country road on the way to work, Sport/Manual mode. I put my foot down

started to accelerate down the road when the car seemed to suddenly over-rev. The power was cut, the dash lit up like a Christmas tree with the gear/cog on the display and a message on screen appeared telling me the car might not start again when the engine was stopped and to drive straight to BMW!
(very very butt clenching message)
I was about 2 minutes from work so I crawled to the office thinking that I would call the AA from there.
When I stopped and put it in park the message changed to something like "restarting the engine might clear the problem".
Turned the car off, counted to 10 (as you do), hit the start button and it started up like nothing had happened and all the lights cleared! I called the garage and booked it in for the next day anyway and then drove it home like it was made of glass after work.
After checking it the garage told me there were no active codes on the car and no sign of any leaks and such.
However... the error code history showed that the gearbox had registered a loss of contact with the engine, the engine showed a gearbox overheat and there was another one that was "basically the EMS going WHERE HAS THE GEARBOX GONE?" !!! All within a fraction of a second of each other.
The guys at the garage couldn't explain it other than 'maybe' a sensor glitch out. (and to have a dig about having it tuned.. they don't like it being tuned...)
I'm back to driving it normally now (but not quite fully trusting it yet). I really hope it was a random one-off.