Clean the MAF (it free assuming you have the proper cleaner for a MAF), then go from there.

After checking for vac leaks move onto tune-up. Plugs, wires, air and fuel filters. Most people forget about replacing the fuel filter for some reason.

Also, no need to "rebuild" the entire head. As long as it's not cracked/leaking then leave the heads alone and on the motor. HG issues with these motors are very rare. Just do the LIM gaskets and valve covers. You most likely do NOT have a compression leak. If you did then it would run like sh*t all the time, not just for a few seconds.