Thanks pgas! I was just about to try patching something together when I saw your binary. Very cool, this is exactly what I needed!
FYI, you can set "which" to 13 instead of 9 and give several other status numbers to have the mail LED flash/blink in many different ways. If you set "which" to 12 you can control the battery LED.
If I get ambitios, I'll modify your code to take more options later this week, unless someone with real C++ skills gets to it first.

Now it is just too bad that there is no way to keep that LED blinking after the Z goes to sleep.