Bizarre random and distressing unwanted thoughts are normal with anxiety, they are also a characteristic of ocd which is co-morbid with anxiety too.
Nightmares and very bizarre dreams are also common, as are intrusive automatic thoughts of which you cannot control.
Distraction is a good coping strategy as is allowing the thought to come, briefly acknowledging it then rationalising it as bizarre, untrue, unrealistic etc and dismissing it as so. This takes a fair bit of practice and needs to be done every time the thoughts come.
You mentioned withdrawal from morphine, quite severe anxiety can occur after use of an opiate based drug, due to the neurotransmitters in the brain being out of sync, this will settle down in time.