Last-minute Montpellier edge Bath