The clock showed 99 minutes and 55 seconds when replacement hooker Chat dotted the ball down after nine penalty scrums, and Camille Lopez slotted over the conversion as France saved their place in the second pot ahead of the 2019 World Cup draw.
Wales had victory in their sights when Leigh Halfpenny's sixth penalty earned them a 18-13 lead but France won a key five-metre penalty scrum with one minute left.
Eight scrums later, after Wales prop Samson Lee was shown a yellow card and a series of controversial incidents and decisions, France finally got over the line for the second time.
Lopez scored two penalties and two conversions, making sure Les Bleus will finish the championship in third or second place and leaving Wales in fifth ahead of the Ireland v England clash.
Guy Noves's team started well, going ahead when Remi Lamerat collected a subtle chip over the top from Lopez and dive over the line, with the flyhalf slotting home the conversion and he added a routine penalty as France's domination continued.
Wales, however, responded with a Halfpenny penalty after Virimi Vakatawa was shown a yellow card for a deliberate knock on and Halfpenny booted another as Wales took advantage of being a man up.
Wales reduced the arrears again when Halfpenny slotted his third kick as France were penalised time and again by referee Waynes Barnes.
Read the full article on eurosport.co.uk: France sink Wales after chaotic and extended finale