The PCM is located inside the cab behind the kick plate in front of the passengers door. Under the hood on the passengers side at the firewall you will see a bundle of wires going into a plug. This plug is held by a single bolt that screws into your PCM inside the cab. Unscrew the bolt and pull the plug and this will disconnect your PCM. I would try hosing this plug down with WD 40 to remove any moisture or bad connections. Replug it and see if that fixes your problem. Important note : DISCONNECT YOUR BATTERY BEFORE WORKING ON THE PCM. HANDLE THE PLUG GENTLY AND USE CARE WHEN REMOVING AND REINSTALLING PLUG SO AS NOT TO BEND ANY CONNECTORS.
If you have to remove the PCM, remove the kick plate inside the cab. Remove a latch and two bolts and then remove the PCM. The PCM has all the part numbers you need for a replacement. NOTE: The PCM is the largest of two boxes behind the kick plate. The small one is the control for your air bags. The larger one (about 10" x 8") is the PCM.
Since you just bought this truck, I would not trust that the PCM is the correct one for your truck. In fact, one guess would be that the guy who sold you the truck got rid of it because of the PCM problem. Another guess would be that they cleaned up the engine compartment before selling the truck and they got water where it shouldn't be. To make sure you get the correct PCM, spend some time at FordParts.com. Put in your VIN number and look up your PCM. Compare this to the PCM in your truck.
Final note: Take your time in figuring this out. Look at what is going on with your truck, what work has been done, and don't jump to conclusions or start fixing stuff before you cover your bases. Lots of problems with vehicles and any machine occurs by trying to fix something and then breaking something else.