Here's the answer:
“se me ocurrió ... ”
Watch a real native speaker say it:
Here's how it sounds in a textbook:
You could also say:
- se me ocurrió...
Fun fact: the hundreds of thousands of people learning Spanish with Memrise get this phrase correct 97.25% of the time!