I've seen a trio comparison of the same shots, K100D vs. FZ50 vs. Fuji S9000 and the K100D wins easily. Lower noise, better dynamic range, more subtle colours. My son owns an S9000 so I can confirm it personally as well, but it's good for a bridge camera, I would be happy to use it for normal snapshots. Bridge camera can't do the narrow DOF (depth of field) trick that DSLRs can though, whereas DSLRs can just about do a deep DOF with a small aperture setting. Where the K100D slips up is in auto white balance (AWB) accuracy, the Fuji is much better in my personal comparisons in artificial light especially.
So, with the K100D you have to work at it a bit more to get those really good results, either RAW or manual WB for artificial lighting, perhaps some post editing (sharpening mostly). It's usually OK in daylight using AWB or a preset WB though.
The D40 is good but has less capability due to no SR and no internal lens motor etc so you're going to end up spending more money on lenses if you get the LBA bug. Also, I just don't like the D40 noise reduction used by default at high ISOs, too smooth and no detail, but would suit someone with zero interest in post editing. A D50 is a better bet though if you can find one. That was the one I almost bought at the time of getting my K100D, but SR and old lenses won the day.
The Sony H5 you mention doesn't have a hot shoe. That is SO restricting, you can get amazing indoor shots with bounce flash and I would be reluctant to ever buy a camera without one unless it was a shirt pocket job. You can also get amazing indoor shots with a cheap second hand large aperture prime lens with the SLRs, especially with the K100D with its SR and excellent backward compatibilty with old lenses.