Used after the past tense to indicate that immediately after one thought/assumed something, another event happened (no sooner than/as soon as).
家に着いたと思ったら、鍵を忘れたことに気づいた。
Just as I thought I had arrived home, I realized I had forgotten my keys.
雨がやんだと思ったら、また激しく降り始めた。
No sooner had the rain stopped than it began to pour again.
試験が簡単だと思ったら、最後に難問が出た。
I thought the exam was easy, but then a difficult question appeared at the end.
When one has a thought or impression, used to introduce what one thinks or what comes to mind (at the thought of / when I think that).
彼の話を聞くと思ったら、昔のことを思い出す。
When I hear him talk, it makes me think of the past.
桜を見ると思ったら、学生時代の友人を思い出す。
When I see cherry blossoms, I think of my friends from school days.