We perform a multi-wavelength polarimetric study of the quasar CTA 102 during an extraordinarily bright {gamma}-ray outburst detected by the Fermi Large Area Telescope in 2012 September-October when the source reached a flux of F_>100MeV_=5.2+/-0.4x10^-6^photons/cm2/s. At the same time, the source displayed an unprecedented optical and near-infrared (near-IR) outburst. We study the evolution of the parsec-scale jet with ultra-high angular resolution through a sequence of 80 total and polarized intensity Very Long Baseline Array images at 43GHz, covering the observing period from 2007 June to 2014 June. We find that the {gamma}-ray outburst is coincident with flares at all the other frequencies and is related to the passage of a new superluminal knot through the radio core. The powerful {gamma}-ray emission is associated with a change in direction of the jet, which became oriented more closely to our line of sight ({theta}~1.2{deg}) during the ejection of the knot and the {gamma}-ray outburst. During the flare, the optical polarized emission displays intra-day variability and a clear clockwise rotation of electric vector position angles (EVPAs), which we associate with the path followed by the knot as it moves along helical magnetic field lines, although a random walk of the EVPA caused by a turbulent magnetic field cannot be ruled out. We locate the {gamma}-ray outburst a short distance downstream of the radio core, parsecs from the black hole. This suggests that synchrotron self-Compton scattering of NIR to ultraviolet photons is the probable mechanism for the {gamma}-ray production.