Expressing unexpected outcomes; 'just when I thought', 'but'.
Sentence + かと思いきや, (Noun/ な-Adjective + だ/ い-Adjective/ Verb (past form) + かと思いきや)
Long explanation:
The ~かと思いきや grammar point is used to express cases where outcomes are different than what was initially thought or expected. It can be translated as 'just when I thought' or 'but' in English. Note that, it is usually used when the speaker was proven wrong by what happened right after his/her assumption.