The key was for Spock, Kirk et al to not believe in them. Then they disappeared. But not before Spock Kirk et al kicked their bwtts.
(That was a plot flaw, though. Why and how can you kick their bwtts after you know they're not really there?)
Hey, atheists fight what they say they don’t believe in all the time.