Hysteresis and first-order phase transition in the two-dimensional electron gas