It's frustrating, I know, but don't give up. I'm sure we can get to the bottom of the problem
Are you using a single focus point and AF.S? If not, you should be - for these situations, at least. And have you carried out AF fine adjustment for your lenses with the K-5? Is SR switched on?
In the second shot, the area in focus appears to be some way in front of the subject (look at the text on that hat, towards the bottom of the frame).
It's worth noting that the K-5 isn't the best at focusing in low and certain types of man-made lighting. Having said that, I've had very few problems with mine.
Lastly, are you shooting RAW or JPEG? If JPEG, note that the camera's processing engine is likely to rob a lot of detail from the shot due to noise reduction. At something like ISO 5000, you want to be shooting RAW and processing the image yourself in something like Lightroom, RawTherapee or similar.