Ford Ranger 4.0, 172,000 miles rough idle when starting after sitting overnight or after 2-3 hours. Starts 1st crank, idles rough 1 minute?

Or so and then smooths out and runs fine. New heads and gaskets. Cleaned MAF sensor, throttle body and air intake sensor, new IAC valve, new air and fuel filters, new PCV valve. No smoke coming from exhaust and No check engine light. Any ideas what's causing this rough idle?

Think back to the old days ( 1950s and 60s ) when we used to have to pull a choke on the carburetor to get the car to start. If you didn't set that hand choke just right, the engine would run rough for a couple minutes until it warmed up enough for you to push the choke off… Then it ran fine. So, just saying, the cold engine 'choke' ( now computer controlled) needs to be checked.

Could be a bad / dirty spark plug, faulty idle air control valve, faulty cold start injector, faulty maf sensor, dripping throttle body injectors that make cold startup too rich, faulty fuel pump check valve and a few other things. Don't suppose you've bothered to check for fault codes on the computer?

Typical symptoms of fouled injectors. A poor spray pattern presents as poor cold start. Cold engines need well atomized fuel.

Now's a good time to clean the throttle body and the IAC valve.