There are a lot of variables, but first, you have to consider payload. The recommended payload is rather anemic in older trucks compared to the models for the past 8 years or so for all trucks and even newer for Dodge and GM. The problem with newer trucks are the additional emissions in the diesels. The problem with a gasoline truck is the length of life of the engine compared to diesel and less powerful engines for towing and hauling.
With those factors in mind, I'd say that any newer truck with less than 50K miles would be worth considering. After that, you have the potential for issues, so the price should consider a potential failure.
The last time I looked, the major part of the value is decreased on a new one in first 3 years. You can look up values to see what it looks like now. However, to compare to MSRP since most trucks can be had for less than MSRP and with incentives could be cheaper to own than a 1 year old truck. If you bought a 3 year old truck and added an extended warranty, you would be close to a new one in reliability with the added protection if something went wrong.