I have a '98 4x4 with the 5.4. I had the same problem a while back. It was just like I had put some WAY CHEAP gas in my truck.
I undertook the painstaking task of new plugs. Although the truck needed them, it didn't help my problem.
I started searching the forum for a solution. I found two good ones. I tried two things at the same time. I wish now that I had done them one at a time to see exactly which one worked.
I read on one of the engine forums about pulling the main harness away from the a/c evaporator. I know it sounds funny but check out this link to the thread. FYI: 5.4L F-150 Owners...
Second, I cleaned the MAF Mass Airflow Sensor. It was NASTY! Here is a link to one of the sponsors with a detailed description on how to do it. http://www.fordf150.net/howto/clean-...low-sensor.php
Like I said, I did both of these and no more pinging or rough idle!