Canada's Villeneuve gambled he'd have enough gas to finish the race, but guessed wrong, slowing halfway through the last lap.
Allgaier used the opening to slip by him and take the green-white-checkered finish. It was his third career Nationwide win and first since June 2011 at Chicagoland.
Sam Hornish Jr. moved into second despite being involved in two separate crashes earlier in the race.
Villeneuve had just enough fuel to hang on for a third-place finish after leading for 43 of 81 laps.
Nationwide Series points leader Elliott Sadler finished fourth and Canadian Ron Fellows rounded out the Top 5.
Swim Week Miami Beach 2014 [PHOTOS]