Sure it is possible. You just need the ECU, wiring harness, custom engine mounts/exhaust, instrument cluster, antitheft devices, lots of money, lots of time and a good divorce lawyer for when your significant other leaves you.
If you can't afford a brand new truck and you don't have a pretty well equipped shop as well as a good deal of fabrication/mechanical skills and a good amount of skill with electronics, I would not suggest this project... it is not gonna be a weekend thing.
An easier swap would be to a diesel engine like a 4bt cummins, b3.3 cummins, isuzu 4bd1, older ranger diesel (the small underpowered one) or a mercedes om617. There are a couple of gas engines you could swap in as well that with the proper tuning can give you reasonable fuel mileage while still giving you a good bit of power. A 302 can be tuned to give you above 20 mpg, and I hear that Trucks on Spike TV swapped a 4.6 DOHC out of a Lincoln continental into a ranger (though they later went to a Cobra's DOHC 4.6). My old continental could get up to and over 30 mpg cruising and had a TON of power if you pressed the noise pedal. I should note though that any of these swaps will likely cost you more than your truck is worth, so, save up your pennies.