(on edit: Mods... if I'm totally off-base here (wrt accuracy)... just go ahead and remove my post. No sense confusing the guy. Thx.)
OP...
I'll preface this by saying I have the V8 in mine... but here's what I remember about the 4.2L model years... If I'm slightly wrong about this, someone will come along and correct me...
- '08 truck only interchanges with '08 engine (you already know why)
- '06-'07 interchange only with each other (I forget why, although I remember the cylinder head changed, but that in itself wouldn't be the reason)
- '02-'05 are basically interchangeable (might need to swap an accessory or two over, but otherwise doable).
So... how to fix, for you?
If you can't return / no '06-'07 engine available...
- You'd need a revised wiring harness, a 58x crank position sensor, and an '08 PCM, at a minimum
Or...
- You take out the '08 engine and swap reluctor rings (pretty sure they're like the V8; those can be swapped). Obviously, this means pulling the oil pan at a minimum, and likely removing the crank (the reluctor is a press-fit). A lot of work, especially if the crank gets removed.
You don't want to just throw the old '06 engine's crank in the '08 block (provided it's good). A lot of precision measurements need to be taken to ensure tolerances are good. A different bearing set might be needed (for sizing), and I'd probably put in new main / rod bearings anyway, even if you didn't have to use under- / oversized ones.
Possible to swap 'in-car' ? Maybe... *if* you don't have to remove the crank. If you do, then I'd rather take the engine out of the truck and put it on a stand. I wouldn't trust myself to R&R a crankshaft with the block in the truck. Maybe, with a second person under the truck with you, helping to lower / raise the crank into position without damaging it. That's a big 'maybe', though.
If the crossmember isn't removable, you have 4WD, etc., -- then it's gonna be easier to pull the engine (although the front driveshaft actually goes through a cutout in the oil pan on this truck, so you'll still be messing with the front diff to some extent).
If this is even possible, you'll most likely be moving the transmission back a bit to make room, as the torque converter attaches to the flexplate, which attaches to the crank. New bolts for the crank <> flexplate (with red loctite), as well as a new rear main seal.
I don't know how much clearance there is between the back end of the crank and the block (so that the reluctor can slip out from between.) Probably not enough.
TL; DR: It's 'fixable', but some pain will be involved, either way. Pick your poison.