I have both a K5 and a K5IIs and when they get heat soaked - too hot, I get a small red thermometer icon on the rear screen - sensor is too hot, usually from Liveview operation. It really depends on the context of your use - 1) liveview heating up the sensor, or 2) heat soaking, etc. Living in Arizona, I use to take my equipment to work October/November through April or May, leaving my bag in the truck so that I could shoot after work [I can't take them inside at all - as it's not allowed, cell phone cameras have to be disabled too]. I just turn the camera off and let it cool down for a while, and then they are all right. Once this happens - that's it for the rest of the year - till winter arrives... again.
Since you didn't get the small red thermometer, but rather the F--, I would think that the interface to the lens dropped out - for whatever reason. I would just re-seat the lens on the camera body, perhaps also remove the battery for a bit just so that the camera will fully reset. Then, try it again. If that does not work, try the eraser to the interface pins - being careful to not get anything inside the camera body. Also, try another lens as a test.