“Or so I thought” is an expression that a speaker uses to explain that in the past they had one idea or belief they thought was true- but they were mistaken.
“I was the best runner in my school, or so I thought. But the new transfer student beat me in the 100m dash”.
We start with a belief: I am the best runner. In the second sentence we find out a new fact that contradicts that belief : another student was faster than me. The “or so I though” is the speaker’s way of saying they had a mistaken idea.
In movies or TV sometimes the character won’t fully explain the situation. This gives good dramatic effect as the audience has to think why they were wrong.
“She was the best girlfriend ever, or so I thought.” This implies that he discovered something to make him think she wasn’t a good girlfriend.
“I got home to find my roommate had drank all my beer, or so I thought.”
This could mean two things:
a) the roommate didn’t drink all the beer. Some was leftover.
b) someone else drank the beer, not the roommate.
“Everyone had forgotten my birthday, or so I thought.”
Maybe people pretended to forget the birthday and threw him a surprise party.
“Or so I thought” has other variations:
“Or at least that’s what I thought”,
“Or so I assumed”,
“Or so it seemed”.
But they all carry the same basic meaning.