Yes, the iMac late 2009 supports Target Display Mode
Cable Supported: Mini DisplayPort to Mini DisplayPort
Port on Source Computer: Mini DisplayPort or Thunderbolt
Thunderbolt ports are backwards compatible, meaning they support MiniDisplay Port cables. Your iMac 2009 with MiniDisplay Port does not support Thunderbolt. So you will need a Mini DisplayPort to Mini DisplayPort cable; this would then be plugged into Mini DisplayPort in 2009 iMac and Thunderbolt port in the Air.