There is mounting evidence that the stellar initial mass function (IMF) could extend much beyond the canonical Mi ~100, Msun limit, but the impact of such hypothesis on the chemical enrichment of galaxies still remains to be clarified. We aim to address this question by analysing the observed abundances of thin- and thick-disc stars in the Milky Way with chemical evolution models that account for the contribution of very massive stars dying as pair-instability supernovae. We built new sets of chemical yields from massive and very massive stars up to Mi ~ 350 Msun, by combining the wind ejecta extracted from our hydrostatic stellar evolution models with explosion ejecta from the literature. Using a simple chemical evolution code we analyse the effects of adopting different yield tables by comparing predictions against observations of stars in the solar vicinity. After several tests, we focus on the [O/Fe] ratio which best separates the chemical patterns of the two Milky Way components. We find that with a standard IMF, truncated at Mi ~ 100 Msun, we can reproduce various observational constraints for thin-disc stars, but the same IMF fails to account for the [O/Fe] ratios of thick-disc stars. The best results are obtained by extending the IMF up to Mi = 350 Msun and including the chemical ejecta of very massive stars, in the form of winds and pair-instability supernova explosions.Our study indicates that PISN played a significant role in shaping the chemical evolution of the Milky Way thick disc. By including their chemical yields it is easier to reproduce not only the level of the alpha-enhancement but also the observed slope of thick-disc stars in the [O/Fe] vs [Fe/H] diagram. The bottom line is that the contribution of very massive stars to the chemical enrichment of galaxies is potentially quite important and should not be neglected in chemical evolution models.