I get the same thing. I'm not diagnosed with OCD, because my symptoms aren't serious enough to cause significant interference with my life, but my Pdoc does consider that I have OCD tendencies. The type of thoughts you're describing sound like 'intrusive thoughts'. Sometimes I'll be standing on the platform waiting for a train, and out of nowhere my mind will just go 'jump in front of the train' or if I'm waiting to cross the road my mind will suddenly say 'step in front of a truck'. It's not the same as when you are having suicidal ideations & you have the odd fantasy about throwing yourself under a bus, these are thoughts that just spring into your head with no rhyme or reason.
Intrusive thoughts - Wikipedia, the free encyclopedia