I had this issue and figured it out.
Generally, on my late 2009 iMac it ONLY works using a mini dv port to min dv port. You can plug the mini dv port into the mac and a macbook pro's thunderbolt port. Even though the cables on the thunderbolt look the same as the mini dv, they will not work for target monitor mode.
The key if you get the background of your computer is that you need to turn on preferences, open displays, and click ON the "show mirroring options in menu bar when available" option in the lower left corner.
Then go to your display setting tab to "arrangement" and click "mirror displays".
What is currently happening on your monitor when you only see the background is that your active mac is using your iMac as a "second" display. Which means you can drag windows to that screen with your mouse. This might be helpful if you wanted to use two displays at one time! You can even drag your screen around to match the physical position of your computers so when you drag from one screen to the other it is more logical and natural.
To turn the iMac into the same display as your MacBook (or other connected computer) simply click the "Mirror" option in the arrangement panel and now it shows the MacBook's screen.
Your Macbook will now appear on the other screen with the same desktop and dock.