Hi JJ,
It looks like the specs on Sony's site say it only allows 1080P over HDMI or Component, not over VGA. This would make sense as sending 1920x1080 over VGA would look quiet bad unless you had very well shielded and very short cables.
http://www.sony.co.uk/product/t32-w-series/kdl-40w4000/tab/technicalspecsA DVI to HDMI cable should therefore work fine (as long as your graphics card can support that high resolution). And, because DVI is digital, you should get a perfect picture. What graphics card do you have driving that monster?
On the TV, you will also want to set the Display Area to "Full Pixel" so that the TV runs the panel without any overscan. This should give you the best picture quality.
[Display Area] set to "Full Pixel"