Ligety was in 32nd place after the downhill portion of the event and somehow passed all 31 in front of him during the two slalom runs for a bizarre victory.
Miller seemed headed for gold when he led after the downhill, but the often controversial American straddled a gate on the first slalom run and was disqualified.
Stars Michael Walchhofer of Austria and Lasse Kjus of Norway, among others, also crashed out in the slalom and defending champion Kjetil Andre Aamodt did not even start because of a knee injury.
Ligety had the best time in the first slalom run with Austria's Benjamin Raich taking over the lead. After Ligety had another fast time on the second slalom run to move into first place, Raich crashed -- leaving the surprised American with the gold medal.
Miller was philosophical about his problem.
"I've straddled probably more times than most people have finished slalom," Miller said.
Ivica Kostelic of Croatia won the silver medal Tuesday and Rainer Schoenfelder of Austria took the bronze.