This is an old question, but I thought I would add. I was able to do exactly what you asked in my late-2009 27” iMac. I found a Radeon HD 6770M 512MB GPU that was pulled from a 2011 model on eBay. It dropped right in and since it came from an iMac it woked just fine.
The only big issue is that I am running El Capitan and I was not able to upgrade the OS (I forget if it was Sierra or High SIerra). It would error. There seems to be a conflict with the installer and the graphics drivers. I’m sure it has to do with the non-standard card that is in the machine now. I am happy to just run El Cap until the machine dies on me, but keep this in mind.