Longevity of i5/i7

Solution
Probably 3+ years. The 2600K (~2010) chips still offer very good performance in games today, and games are beginning to lean much more heavily on graphics cards.
I agree with dudeman509. Most games are constraint by the GPU more so than the CPU. Only time that may not be true is if you are using integrated GPU, like an Intel integrated GPU.

The 2nd generation core CPU is still good today if paired with a good video card. I would estimate you can get another year to maybe 3 years tops out of the 2nd gen before you need to start considering a new CPU. Of course this is subject to change if game developers suddenly decide to stop limiting games to console performance.
 
I think the i7 will last a couple years extra than an i5 but in reality, by the time you feel the i5 needs to be replaced, the i7 would 'feel' as though it needs to be replaced too. Its performance would have dropped to that of an i5.
It is all about perception in my opinion. Also depends on the model of the i5 vs i7. High level model of an i5 can be better performing that a lower level i7. Then there is the question of mobile vs desktop. But staying the desktop realm for now.

i7 sometimes gives you more cores than an i5. If you are okay with the i7 feeling more like an i5, you will stretch out the life of the i7 for a bit longer. about 1-3 years longer before computational needs start to drag it down to the i3 arena. There are people still today that play many games with an i7 first generation. This is about 7 years after its release. Each generation since has provided a good sizable jump in performance but it really depends on what you are doing.

High end gaming, is more affected by the GPU you have than the CPU. Of course the better the CPU, will result in smoother loads and in some games piece of mind that your CPU is not bottle necking.

Besides video editing and photo editing(like Photoshop, not some software that came with your camera), which are usually optimized to make use of all the cores in a CPU and even invoke the GPU in calculations, you won't feel much of difference.

So keep in mind what you need it for. You can always donate your old i5/i7 to your grand parents and they won't be know it is old since all they do is surf the web and check emails.

Each generation will provide a performance boots of some sort. Either in calculations(newer instruction sets), energy efficiency or memory caching(for caching instruction sets). The number of cores is important to a certain extent too. Some applications cannot make sure of all the cores. So getting an i7 is not beneficial if your apps cannot make use of its high number of logical CPUs.

In general, an i7, I leave to the enthusiast and people that need it for video editing and photo editing. Regarding gaming, an i5 is what I recommend for the money and it provides excellent performance. Pair it with a good GPU(from the money you saved on the CPU) and you will have a solid build without forking over too much money.

Overall i think the i5 and i7 will both last as long, you can definitely stretch the i5 for a while as well.. just depends how well you tolerate a little stutter here and there towards the end of its life.

In the PC world, the fun part is that you can upgrade stuff.. the sad part is that with a cpu lasting 7 years or more.. you will upgrade your at least once in its life and sometimes by the time you are ready for the new GPU.. it may no longer support the old CPU or old MOBO. Unlikely but can happen.

My i5 2510m (asus laptop) is still going solid! put in a new ssd and it flies like a jet. Of course, new models can probably do the same calculations in a fraction of the time mine can, but a difference in milliseconds, is not enough for me to notice. For programming and running VMs, it is still great! Bought it in 2010 or 2011.