CHECK YOUR IAC VALVE.... if it sticks (open) the air just circulates and eventually will stall the car, or like you said, keep reving it until it stops. mine used to do this, the dealer replaced it and it only seems to do it when it is cold and i down shift hard, but maybe this is the problem you are having...