First check and see if your machine is in the recall pool:
Apple Recall:"
https://www.apple.com/support/macbookpro-videoissues/
It will help us to know how much RAM is installed. I would say you'd need at least 8 GB to be effective.
I personally have avoided Yosemite, read a lot of posts here and on the Yosemite site. I'm still running Mavericks and Lion.
You might also consider upgrading your HD to an SSD:
https://www.macsales.com/
Is the vendor of choice for me.
If you're set on Yosemite the site is here:
https://www.apple.com/osx/how-to-upgrade/
Make a working clone of your current OS before you do anything.
You might do a clean install of Lion and migrate just the applications you want.
"any other junk, bugs or viruses it might have."
If you don't feel it's running up to spec check out the serial number on the recall site.