We study the S=1/2 Heisenberg (J) model on the two-dimensional square lattice in the presence of additional higher-order spin interactions (Q) which lead to a valence-bond-solid (VBS) ground state. Using quantum Monte Carlo simulations, we analyze the thermal VBS transition. We find continuously varying exponents, with the correlation-length exponent "nu" close to the Ising value for large Q/J and diverging when Q/J approaches the quantum-critical point (the critical temperature Tc -> 0). This is in accord with the theory of deconfined quantum-critical points, which predicts that the transition should approach a Kosterlitz-Thouless (KT) fixed point when Tc -> 0+ (while the transition versus Q/J for T=0 is in a different class). We find explicit evidence for KT physics by studying the emergence of U(1) symmetry of the order parameter at T=T_c when Tc -> 0.