A last-gasp Josh Bayliss try secured Bath Rugby a bonus-point win in a thrilling encounter with Northampton Saints at the Rec.