The big differences for me between a 'compact' and a 'dslr' are:
1. When you press the shutter on a dslr, it fires. Now. No lag. For action shots (er, railways?) pretty essential. I'd love to carry a high spec 'compact' in my pocket to catch those shots you miss, but I haven't found one yet that fires 'now'. Unless of course somebody can put me right?
2. You can shoot RAW. The most forgiving way there is with digital. Every JPEG degenerates a little every time you press 'save'. RAWs don't. And much more importantly, the more you learn about post processing, the more RAWs you can rescue that were right offs when you shot them. I've been going through some shots I made in 2005 in China. And I've got about 10% more pictures out of the RAWs I shot at the time because I've learned more about extracting the most from them. Check out my blog at
http://www.mikemccormac.co.uk/wordpress/ to see what I mean - check out the China stories.
And by the way, a D40 is a pretty cool bit of kit...
Best
Mike