Lol, I haven't heard of a common-rail diesel doing that! We used to have that happen from time to time on the old mechanical diesels when the shut-off solenoid stuck (though it was equally common for them to just die for the same reason).
I'd guess a bad ignition switch, or some pinched wires under the dash. The engine computer gets a good chunk of its power from the ignition circuit, so it shouldn't be able to keep running when that shuts off.
I can try and find the electrical diagrams when I get home on Monday. If it does it again, you can probably pull the IGN1 fuse and get it to turn off that way. Probably less likely to bump hot parts that way. Also, I think there is a relay in the under-hood electrical center that will shut it off. Perhaps that is sticking?