it is your battery
these new Fords do that when the battery goes dead, or very nearly dead.
my 06 F-150 went ape**** on me one day just like you described. I took battery from my SUV and the craziness stopped. Original Battery in truck tested out bad at the store
get a new battery that is fully charged and it will go away...sorry it gave you such a scare. If you check the 04-08 F-150 area, you'll see alot of posts about this happening