OS X can do this now, as of Snow Leopard. It's made possible through the Sleep Proxy Service. It's pretty much automatic. The only requirement is that you have a second always-on Apple device on your LAN that can act as the sleep proxy. Their current low-power embedded boxes all support this, I believe: Airport, Time Machine, and Apple TV.
In the general case, though, I believe the answer is no. I'm not aware of any other OS that has implemented a service like this. The technology is open source, so there's no reason this couldn't be everywhere eventually. It's probably too new to see widespread adoption just yet.
You might now be asking, why do you need a second Apple box on the LAN?
When a PC is asleep, the kernel — and therefore the network stack — is not running, so there is no code in your OS that can respond to a "magic" packet of the sort you're wishing for.
Wake-on-LAN magic packets aren't handled by the OS. They're recognized by the network interface IC, which responds by sending a signal to the CPU that releases it from the sleep state. It can do this because the IC remains powered up in some sleep states. (This is why the Ethernet link light stays on while a PC is "off" on some machines.)
The reason the Apple technology works is that just before the PC goes to sleep, it notifies the sleep proxy. The sleep proxy then arranges to temporarily accept traffic for the sleeping machine, and if it gets something interesting, it sends a WOL packet to the PC and hands off the traffic it received.