I just wanted to share my experience because I could not find this online and had to learn the hard way. The local Apple Geniuses also did not know this until I brought them this problem.
If you want to use Target Display Mode on an iMac (use the iMac as an external monitor) and your new computer has a thunderbolt port (and I assume even if it doesn't), you must use a male mini display port to male mini display port cable. You cannot use a thunderbolt cable. This is kind of a pain since Apple replaced their MDP cable stock with thunderbolt cables. But you can still find mini display port cables online.
UPDATE: I discovered this blog too late, but it already covers this and has more useful information on the topic of cross compatibility: http://blog.macsales.com/10899-target-display-mode-and-thunderbolt