Using iMac 21.5 mid 2010 as an external monitor of Macbook Pro Retina late 2013 15"?
I've tried this and yes it does/can work, depending on your setup. So far I've managed to hook a 2012 MBP 13" to a 2012 21" iMac via Thunderbolt, and the cmd + F2 function works once logged in.

However, I've not managed to connect to a 2011 iMac (non-Thunderbolt model) using the same MacBook and Thunderbolt cable - I don't have a DisplayPort cable to hand to see if that works or not so right now I can't verify if yours will work or not.