There are still a significant number of 3.1.3 devices around.
The iphone 2G and original ipod touches can't be upgraded.
Many of the iphone 3G models that were sold are still within their initial contract term, preventing users upgrading to newer devices at a reasonable cost, and users are reluctant to upgrade their 3G devices to iOS4 because of the performance drop:
http://www.tuaw.com/2010/07/28/apple-looking-into-poor-ios-4-performance-on-iphone-3g/
I'm experiencing similar issues; working around bugs in 3.1.3 that are fixed in 3.2 and 4 is really slowing me down, but I just can't exclude 3.1 devices.
Update
I found a very useful graph here:
http://www.appleinsider.com/articles/10/07/22/chitika_ios_4_already_powering_50_of_iphone_traffic.html
It's based on analysis of data from in-app ads, so is no doubt statistically skewed in many ways, but none the less still makes interesting reading.