RonHendriks1966, did you notice that the OP wrote that the Tamron focused just fine with his K10D?
Clearly there is a problem with the Tamron & K-5 combination and it is not easy to determine where the cause of the problem is.
However, given
- the K-5's shoddy AF history (with at least one bug remaining),
- the dependency of your results on light temperature, and
- the fact that the Tamron worked fine on your K10D,
I'd start the trouble shooting with the K-5.
Third-party or not, a camera's AF should not behave like that. The Tamron lens is highly regarded, not only by members of this forum, it has worked with many, many Pentax DSLR models before.