Here is the IFIXIT guide on removing the logic board which you must do to swap out the CPU: iMac Intel 27" EMC 2639 Logic Board Replacement Note their warning here Potentially Dangerous You will need to review the Teardown Step 5 on pulling the CPU.

Here is a good reference tool to see the performance differences between the systems: Ultimate Mac Comparison Chart. You will need to select the different models you want to compare.

Now one does need to look at the Geekbench performance numbers very carefully here as what the system can do in these tests does not reflect in the real world! Most Apps are not programed to leverage Hyper-Threading so you will only gain the raw performance of the i5 not the i7 numbers of the same design & clock speed. Basically you get very little benefit upgrading the current CPUs.

I would strongly recommend you sell your system and get a new one Vs trying to upgrade it, it will cost less if you really need this level of performance and I would jump to a Mac Pro Vs an iMac (which is what we are doing) as you will have much more head room to grow.

This would be extremely risky and I do not recommend doing so. One suggestion I have is getting a decent PC from Dell, HP, Asus, etc. that comes with and i7 or can be easily upgraded to an i7 (you could also build your own PC) . You can install OS X on the PC using a tool like UniBeast and an external hardrive. You can use your current mac as a monitor. While this will be much more expensive than just upgrading your CPU, it will be much less risky, and future upgrades such as a GPU upgrade will be much easier (along with many other perks of having a PC case to hold your parts).

Note the date of the question (2014). Try to stick with the newer posts.

At the time of my answer posting, most apps were still single threaded. Today things are changing! Most now are multi-threaded!

Now the Rub! How many threads does the CPU offer and how many are you able to use with your apps. Generally, i5 CPU's are still the mainstay with either a dual or quad core (2 or 4 threads). Gamers, coders, photo & video processing gain the most with i7's which offer hyper threading (doubling the threads to 8).

On the most part upgrading the HD to a SSHD or if you can swing it a large SSD as well as adding more memory will go farther than the CPU swap out.

Lastly, most people with Mac's want to stick with them.

While creating a Hackintosh is a good option, many don't have the skills to do it. Migrating to a Windows PC likewise wouldn't work if the person has a large investment in Mac apps.