The simplest way to do this would be to edit the cart class /system/library/cart.php
Find this line (from a 1.5.5.1 install - any other version may vary slightly though unlikely to be majorly different)
public function add($product_id, $qty = 1, $option = array()) {
On a new line after it, add
$this->cart->clear();
And save. Note that this allows for a customer to add a quantity greater than 1 to a cart as long as it is the same product