If the TV's resolution is only 720p and you feed it a 1080p source (assuming the set can accept 1080p input), the TV scaler will decimate the source signal to bring it down to 720p. If the TV is 1080p native, it will just display what it is given.
You can argue that the scaling and/or deinterlacing done by the TV will affect image quality but the real issue is how far away from the set you are sitting. You'd have to sit awfully close to a 40 inch set to notice any difference between 720p and 1080p.
Think about an LCD computer monitor running a low resolution like 800x600. When you are sitting right in front of it, it will look terrible but if you were 6 feet away it won't look too bad.