Everybody has a light form, sometimes. So learn to ignore those thoughts, it is most of time enough. Say "no!" to yourself and start to think about something else.
If you really have a serious form of OCD, it will be harder. I know a 24 years boy who has such form of OCD. He goes to psychiatrist because of it and uses medical treatments for depressions etc.
He says that it helps to have some kind of a ritual, like to tap 3x with a finger to end such thoughts. You will probably have to find your way.
All in all, realize that it is a disorder and not your fault. So deal with it as quick as possible, but do not blame yourself for it coming to you. Your guilt is not bigger than of somebody who has a broken leg.