Ok I have the script above made into an application. But there are a couple of caveats.
1. You have to have SSH enabled on your phone. If you disable the SSH service the app will not work.
2. The app will terminate the mail app, so if you are in the middle of composing an email it will be lost.
3. If using exchange, this will not mark the messages read on your exchange server. It will mark the messages read on the phone, but the mark will not sync back to the server.
Download the app here:
markall.tar.gz
Just place the tar file in the /Applications folder and extract, then reboot or respring.
When you run the app it will show a black screen then return to the springboard. Wait about 1-2 seconds and the mail unread count will clear.
Hope this app helps, I use it all the time!