Is the fan the only thing that is not working? After opening up the back, you should check the fan connections for any corrosion and clean those off as well as any other connections inside the computer. If those are all clean you can also do an SMC and PRAM reset that may help.
SMC Reset:
Shut down the computer.
Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
Release all the keys and the power button at the same time.
PRAM Reset:
Immediately press and hold the Option-Command-P-R keys. You must press this key combination before the gray screen appears. Continue holding the keys down until your Mac restarts, and you hear the startup sound for the second time, and on the third chime, release the keys.