The 22-year-old Bahamian, a silver medallist in the world championships in Beijing a year ago, went one better tonight denying favourite Allyson Felix in a dramatic photo finish.
A visibly spent Miller dived across the line to win in 49.44secs with United States heroine Felix just 0.07secs behind.
She took silver, a seventh Olympic medal of a remarkable career, with Shericka Jackson of Jamaica coming in third to take bronze.
Felix had hoped to be bidding for a 200m and 400m double in Rio, but she failed to qualify for the United States team over the shorter distance after struggling with an ankle injury earlier in the season.
And her bid for a first Olympic 400m crown, after gold in the 200m, 4x100m and twice in the 4x400m also fell short.