Let's say you've been working on a problem and you think you've cracked it. But after thiry minutes of review, it turns out you didn't.
1. I thought I finally solved it for a while.
2. I thought I had finally solved it for a while.
For a while is not well positioned. Both solved and had solved signalized a completion. I guess you thought for a while, not solved for a while Maybe:
1. For a while, I thought I finally solved it .
2. For a while, I thought I had finally solved it.
(because I thought for a while I finally solved it would require that I thought for a while that I finally... )
Not only that 2. is more logical, but additionally had solved is the past perfect and we can understand I thought as the expression that asks the conditional (it can express uncertainty). In that case had solved suggests that you did not solved it as in:
- A: "Still nothing?"
- B: "For a while, I thought I had finally solved it."
- A: "If you had solved it, you would have been more certain, you wouldn't just think you had."
- B: "Yeah, I know."
Why and when to think could come under the conditional case:
- I wish I solved it. - but you didn't
- I wished I had solved it. - but you hadn't
- I thought I had solved it. - but you hadn't
I thought says that you just thought, you were not sure (in the present, however, you might know that you were wrong). Not only that. If there is the final success, the fact that you once upon a time thought that it was a success wouldn't be that important statement at all, so it wouldn't stay alone, on its own, unless you want to say that it was actually an incorrect thinking.. However, if this is not sufficient then from the context should be at least suggested that you thought wrongly.
The logic between wish and think is in this case, and only in this case, similar:
- I wish - I solved it, but you didn't. If you solved it, you wouldn’t have wished it any more, because you solved it, why wishing something you already have
- I think - I solved it, but you didn't. If you solved it, you wouldn’t have thought about it any more, because you solved it, it is over, there is no reason to think about it any longer (you should've known you did)