Great-idea [subject-が] last-night I [possessive-の] head [to-に] surfaced.
Another 浮かぶ variation — this time with 頭に ('into the head'). Japanese can locate a mental event in 心 ('heart'), 頭 ('head'), or leave it implicit; each location shifts the nuance slightly.