The game looked set to end in a draw before Rice found space and scored with a header in the final moments of the match to ignite enthusiasm in the visiting team's fans and disappoint Luton fans.
After 20 quiet minutes of play, things changed after Gabriel Martinelli scored after a low pass from team-mate Bukayo Saka to give Arsenal the lead.
Lawton equalised five minutes later with a header from Gabriel Ocho from a corner that goalkeeper David Raya could not save.
Luton goalkeeper Tomas Kaminski stood in front of Saka and Martinelli attempts before Gabriel Jesus restored the lead for Arsenal before the break with a close-range shot.
Luton responded strongly to Arsenal after Elijah Adebayo scored with a header after a 49th-minute corner eight minutes before Andros Townsend passed to former England team-mate Ross Barkley, who hit a low shot that Raya miscalculated.
But Kai Havertz equalised for Arsenal after about an hour of play before snatching Rice with a thrilling victory for his side.