Gregor Townsend's side trailed 20-5 and 23-12 but rallied in the second half with a 74th-minute try from replacement hooker George Turner sealing the victory.