The multi-TeV energies available at LHC have opened up the possibility to measure, for the first time, various high-mass elementary particles produced in nuclear collisions. However, the two heaviest elementary particles in the standard model remained without direct observation. Whereas the Higgs boson lies beyond the reach of heavy ion collisions at the LHC, the top quark is accessible for experimental study in proton-lead (pPb) and lead-lead (PbPb) collisions. More specifically, the top quark constitutes a novel and theoretically precise probe of the nuclear parton distribution functions, in the poorly explored region where partons have a large fraction of the nucleon momentum, as well as of the properties of the produced quark-gluon plasma. In this talk, we review top quark measurements in pPb and PbPb collisions, and the accompanying proton-proton reference ones, performed by the CMS Collaboration. The focus is put on the recent evidence in PbPb collisions at a nucleon-nucleon center-of-mass energy of 5.02 TeV, using an integrated luminosity of about 1.7/nb.