This paper deals with polynomial perturbations of the cubic defocusing nonlinear Schrödinger (NLS) equation on the one-dimensional torus, i.e., equations of the form $$ i\dot\psi = - \Delta\psi + F'(|\psi|^2)\psi, \quad x\in\Bbb R/(2\pi), $$ where $F(x)\coloneq \sum_{j=2}^q c_j x^j \geq0$ for all $x\geq0$ and $c_2>0$. \par The authors prove that, for initial data in a set of large Gibbs measure, all the Fourier coefficients of the solution remain approximately constant for times of order $\beta^{2+\varsigma}$, where $\beta$ plays the rôle of the inverse of the temperature and $\varsigma=\frac{1}{10}$. This is noticeable because such a timescale is longer than $\sim\beta^2$, which is what one would get by simply using the fact that the cubic NLS is integrable and that therefore the first contribution to a nontrivial dynamics of the Fourier coefficients comes from the terms of degree five. The linear frequencies are completely resonant and one has to use the nonlinear corrections to the frequencies to show that the contribution of the terms of degree five is averaged out on a longer timescale. \par The proof of this averaging theorem is based on suitable estimates of the measure of the subsets of the phase space in which the nonlinear frequencies are nonresonant and on a formal scheme of construction of approximate integrals of motion.