Another member, "loddie", recently had this same exact problem with his K100D. He took his apart to replace a dirty viewfinder, and then put everything back together. He thought he put everything back exactly the way it was, but the camera powered off immediately whenever he powered it on. Here's a link to the thread:
https://www.pentaxforums.com/forums/pentax-dslr-discussion/168336-took-k100d-...mediately.html
As far as I know, he was never able to figure it out. Maybe you two can put your heads together and figure this out. It also might be a good a idea to try to get on the phone with a technician at a Pentax repair facility, and see if they can help you out.