The network gradually forgets about 0-confirmation transactions if no one is rebroadcasting them, so it's possible to cancel a 0-confirmation transaction if it doesn't make it into a block for several days. The client doesn't support this yet, though -- it rebroadcasts forever.
So... How is this preventable? It seems to me like quite the large issue...
Wait for a few confirmations.
I see. This still doesn't solve the issue of someone choosing which bet to confirm on a gambling site such as satoshidice. The only issue I can see is that it would potentially take solving a block or two before being able to do anything.