Francois Louw's last-minute try preserved Bath's 100% record in the Amlin Challenge Cup as they battled to a 27-22 victory at Agen.