Certainly the fact that your iPhone will be supported for at least three years with iOS updates is at least part of why iPhones hold their value. This is in marked contrast to many Android phones which NEVER have an Android update offered. A friend of mine at work told me that when he bought his Android phone a new version of Android OS had just been released and that he was promised that that new version would be available for his hardware within a few months. It never happened. Android user base is fractured, not because the users WANT to use an older version, but because they don't have much choice, unless they want to root their phone (or whatever the term is for that). The carriers would much rather sell you a new phone with a new contract than spend their resources on configuring a new OS to work on old hardware.
Or so I have read.
Apple, on the other hand, making both the hardware AND the software, does a pretty freaking good job at supporting their products. It's all relative, of course. Some people are mad as hell when their three year old hardware can no longer run the latest OS. But not me. I figure, hey, it's technology. It's rapidly evolving. If I can count on three years, I'm happy.
That said, my laptop is from 2008! It's a pre-unibody Macbook Pro (Penryn). And somehow, I keep being able to install the latest version of OS X! LOL! And it looks like I'll be able to install Mavericks on it, too. It's OK with me. I still love the thing. But I won't keep it longer than one year from the point at which I can no longer run the latest version of OS X.
One final thought on the iPhone value-holding question. And that is that all the AT&T iPhones can be FACTORY UNLOCKED after your two year commitment is fulfilled, and I've noticed that these command the best prices online. Probably because, being GSM phones, they can be used in Europe. And I know that, at least in Cyprus, the only carrier that subsidizes the iPhone is undesirable. So, for those who want an iPhone, the best option is a used, unlocked one.
Taken in isolation, I think the Android hardware compares quite well to the iPhone hardware, but it's NOT an isolated thing. For those of us who love, and run, OS X laptops and desktops, iOS and iPhone hardware present a lot of advantages. Or at least that is my opinion. If I were overseas and had a choice between a new Galaxy S3 and a used iPhone 4 or 4S, I'd definitely go for the iPhone, even at the same price. But, that's me.