You don't mention the actual model numbers of the TV's you're looking at. For instance, there are several different Sony Bravia models at the 40" size. There's the XBR1, the XBR2, the XBR3, the S2000, the S2010, and the V2500. Which one are you looking at? The XBR2, XBR3, and V2500 are 1080p, and therefore more costly than the 768p models.
Same thing goes for Sharp and Sammy. They have several models at the size you're listing.
Regarding the Contrast Ratio, it's pretty much a useless number to go by when comparing different manufacturers. This is because there are several ways to measure CR and depending on the method used, the numbers will be different. When you see CRs of 5000:1, and higher, for LCDs, they are using Dynamic CR. In the old days, they measured using Static CR and typically, the CR's were around 800:1. And even then, one manufacturer may measure Static CR different from another manufacturer so it's really confusing. It's mainly a marketing number these days.
As far as 1080p goes, it's nice to have, but not entirely necessary. We bought a 46" Sharp 1080p TV recently and we love it. I mainly wanted 1080p because I plan on hooking up a Mac mini to it and wanted the extra resolution. For a 40"/37" LCD, you're probably not going to notice the difference between 1080p and 768p displays, all else being equal, when watching TV and movies. If you hook a computer up to it, you'd notice.
Also, in response to the Sony/Samsung comment. Sony does not buy their panels from Samsung. They are both invested in a LCD plant and therefore they use the same panels. The electronics will be different, so there could be some premiums paid there. Also, smaller sized panels are becoming a commodity and may be outsourced to one of the Taiwanese/Chinese manufacturers. Right now, sizes under 46" are quickly becoming outsourced. I know that Sharp outsource many of their TV's under 46". You have to be careful, but the outsourced TVs are usually their lower tier lines and are priced accordingly. I don't know if Sony or Sammy outsource panels/TVs.
ft