Sounds like its running backwards. I never saw a diesel do this but I have seen more than one gas engine run this way. In these gas engines almost always there was carbon buildup. the tip of this carbon gets hot when running when you go to shut off the ignition the carbon is hot enough to ignite any gas in the engine. At some point while it is trying to stop turning the detonation of the gas pushes it back the other way and it may run like this for a couple of minutes.
Come to think of it I know a guy who did have a diesel going backwards. He was climbing an icy hill and at some point the drive wheels got enough traction to grab and the force stopped the engine and got it going backwards. He said it was blowing oil out the breather by the quarts. he quickly shut off the fuel.