Cylinders 3,4,7 &8 are the rear four cylinder. Maybe you got water in the plug holes. I'd pull the coil packs and check for water/damp above the plugs. I wouldn't remove the plugs unless your sure it is dry in there, as removing plug would let any water drain in to the cylinder.
If there was water in there might have blown your coil packs. The test for that would be to move one of the indicated coil packs to a working cylinder and see if the fault code moves with it.
An e39 is like a beautiful wife, needs constant attention, lots of money, lets you down at the worse times but you’d never be without it.