In 2008, AGILE and Fermi detected gamma-ray flaring activity from the unidentified EGRET source 3EG J1236+0457, recently associated with a flat spectrum radio quasar (GB6 J1239+0443) at z = 1.762. The optical counterpart of the gamma-ray source underwent a flux enhancement of a factor of 15–30 in six years, and of ∼10 in six months. We interpret this flare-up in terms of a transition from an accretion-disc-dominated emission to a synchrotron-jet-dominated one. We analysed a Sloan Digital Sky Survey (SDSS) archival optical spectrum taken during a period of low radio and optical activity of the source. We estimated the mass of the central black hole using the width of the C iv emission line. In our work, we have also investigated SDSS archival optical photometric data and ultraviolet GALEX observations to estimate the thermal disc emission contribution of GB6 J1239+0443. Our analysis of the gamma-ray data taken during the flaring episodes indicates a flat gamma-ray spectrum, with an extension of up to 15 GeV, with no statistically relevant sign of absorption from the broad-line region, suggesting that the blazar zone is located beyond the broad-line region. This result is confirmed by the modelling of the broad-band spectral energy distribution (well constrained by the available multiwavelength data) of the flaring activity periods and by the accretion disc luminosity and black hole mass estimated by us using archival data.