I have been designing software and systems now for nearly 40 years. A lot of has been for embedded systems. In some ways it does not surprise me that live view was involved as that mode I would guess is the least used mode, and probably is the least instrumented in the EXIF meta data associated with the images. Essentially. in order to capture the data you need to take the picture, so the event needs to be occurring in order to record data about it.
These new cameras are more computer and less camera each generation. The software in these cameras, and there are multiple logic devices residing inside - processors, ASICS, FPGAs, etc. probably represents around at least a million or so lines of source code. Its also real time software which is even more difficult to design, and implement. This is also lot of code to integrate, even if its being reused from previous bodies, there are always complexities (and real time irregularities) that are not foreseen. So these events really do not surprise me. After all is just an optical, electro-mechanical, real time, magnetic suspended, battery powered, hand held portable consumer device.
It is impossible for any company to test each path through their "system" at consumer prices, unless the code is really quite small - or human life is at stake - aka FAA certification. To do an exhaustive "formal methods" testing to an EAL7 level on even a small software base, takes the better part of a year and starts at $10+ million and goes up very rapidly - and the FAA has not gone down that path - yet. And the K5 software base is substantially larger that a "small software base", by several orders of magnitude.
Do a search of any of the other cameras that you are considering and you will find problems also. The grass is always greener on the other side of the fence.
Its unfortunate that Pentax has had problems with the K5 - the stains, the flops, and the tungsten lighting auto focusing. I do think that perhaps better QC/beta testing might have caught some of these, and it would always be nice for the company to acknowledge them. But it is what it is - and the market is very competitive.
I use my K20 mainly in the evening with ambient low light, that just exacerbates the noise even at low ISO, so the K5 would be a very good step up for me, especially in the dynamic range department. The price is also coming into my range of pain tolerance. Do these problems concern me - of course. What am I going to do - I have too much glass to go somewhere else, and I know that I'll just find yet another set of problems, and I am not one to jump across brands. There is an old saying - better the devil you know than the one you don't. I have not purchased any SDM lenses, my tripod and head, with the old screw driven glass does very nicely at f5.6 to f8 even in the "dark". And I have just changed mounts on a couple extremely nice 25 year old f2.8 manual Zeiss lenses. I also like Pentax's ergonomics. Not changing....
So no matter what you do or whose camera equipment you wind up with, there are going to be problems - especially with complex systems that consist of consumer electronics that are purchased at an affordable price.
A $20 2 year extended warranty will keep Pentax on the hook to fix and repair the problems. Unfortunately, you are out the use of the camera. My K20 had the guts changed out - and that took 3 weeks for parts to arrive.
I am not making excuses at all for Pentax. We all want the latest and greatest, at the absolute lowest prices, with superb customer service, right this instant - with out any errors.
I'll probably be in the same position as you later this year. Do I know what to do. I haven't figured that out as of yet....
I figure that in a few months after getting a K5 and having problems - someone will be spoon feeding this back to me - word by word. Hopefully not - knock on wood...