ELECTRICAL HELP!!!!
It's probably not the motor. And if you've checked your Battery, Alternator / Voltage Regulator and all of their Grounds you've ruled out a big source of electrical issues. But... there's other areas that can cause these problems. There are control modules under the dash that could be failing. Also, check under the dash for evidence of wet carpets, and also look at the inside of the firewall / under the dash for any evidence of a water leak. Water is sneaky - you don't notice a slow leak, but if it gets behind your dashboard, it corrodes the wiring, connectors, and electrical components and can cause all sorts of weird problems very similar to what you're seeing.
My Story:
I had water dripping inside the cab from an improperly installed replacement windshield in my '01 F350, V10. The water was getting around the windshield gasket on the driver's side and came down the inside of the firewall behind the dashboard. Over time, it corroded the back of one of the fuse panels, and also corroded / damaged the GEM (General Electric Module) that controls the dashboard functions: the lights, the radio, etc..(Not sure if your '04 has a GEM or if Ford had switched to a BCM (Body Control Module) by that time.)
My leak had been going on for a couple of months after the new windshield was put in - but I didn't realize it until my truck started exhibiting those weird electrical gremlins (like yours). It started out slow. I would look outside one night and the lights would be on in the cab but the doors were locked and the dash switch was off. I would open and close the door a couple of times - thinking that I had sticky/dirty door switch and it would stop. A few days later - the fog lights and the parking lots were on but the witch was Off. Another time - the radio wouldn't shut off until I pulled its fuse. I was hyper jammed up with work and family issues at the time, so I didn't have time to investigate. It wasn't until the truck started doing its weird stuff while I was driving down the road - dash lights flickering, radio cutting out when I activated the turn signals, etc. that I finally took it in to a mechanic.
Mechanic had it a couple of hours and called me in to show me what he found - he took a garden hose and sprayed the windows. In a few seconds there was a steady drip of water coming into the truck behind the dash. He pulled the fuse panel and all of the connections on its back side were badly rusted. He had run some other checks and the GEM came up as defective as well. It was wet inside, and the moisture/corrosion was causing intermittent short circuits which in turn caused the whacky electrical behavior.
It was an expensive repair - fuse panel and GEM weren't cheap, and lotsa labor to re-do the wiring for new fuse panel. Plus needed new carpets because the old carpet padding was sodden and full of mold. Windshield got reinstalled and that stopped the leak. All of the weird behaviors were resolved with the new GEM and fuse panel and connectors.
(On edit) In my case - since I went through my Insurance Company for the windshield replacement, my Comprehensive insurance paid for large percentage of the repairs. The Glass place owner was a stand-up sort of guy and covered my insurance deductible



