How does Satoshi Dice's 'zero confirmations' transaction system work technically?
A transaction claims some outputs from previous transactions and then creates new outputs whose summed value is equal to (or less than, in the case of fees) the sum of the claimed outputs values.

For a transaction to be valid it must be the only one that claims the outputs (no double spend) and the transaction that created the claimed outputs must be valid. Satoshi Dice can immediately send back a transaction containing the winnings because the transaction claims the output of the incoming transaction, chaining the two transactions together.

The result is that either both transactions are valid, in which case the player gets his winnings, or the first transaction is not valid, immediately invalidating the second one, and Satoshi Dice is not tricked into sending coins back without receiving the wager.