After some testing today it looks like my 40mm definitely has an infinity focus problem, anything beyond 30-40ft and it refuses to focus, at first I thought CDAF was OK but although the focus seems to lock it's not in focus and manual focus doesn't help either.
Up to 30-40ft focus is fine, no BF or FF which is the range where I normally use it anyway for low light indoors or close range portraits so I hadn't really experienced the problem much previously (only had the lens 5 months, 2nd hand).
This is maybe a different problem from what the OP was having problems with.
After some searching this looks like something that can occur with some pentax primes, for example another thread here describes the same problem with the
21mm Ltd
Looks like I'll have to get the small screwdrivers out or pay to have it fixed