When the camera was returned the first time, what did the store tell you about what was wrong? There are times that repair operations can't get the problem to duplicate so they just clean it up some and return the item.

I'd wonder if you might be having an intermittent issue like an overheating battery, a lens that isn't quite seated fully, lens/body contacts that need a bit of cleaning or the like. Now some Flash Units will mess with the camera in that in the TTL control system of choice, they won't fire under certain conditions. A re-read of the manual might be in order if this has occured with the flash(either external or built-in) activated.

The one other question I'd ask is, how much do you use the camera and when you do, how many shots do you take? Check your flash card(s) if you have different kinds, to see if one memory card or another causes the problem.

One other question, do you know another user of the same camera? If so, do they shoot similarly to you and have they had ANY problem? Worth checking.

Best of Luck, let us know and you might also put a note in the Pentax forum if this one doesn't get moved there!

We'll look forward to pictures when you get it all sorted out.