I suspect that the cube you are collapsing contains NaN values, rather than (or perhaps in addition to) being a masked array. How was the cube constructed originally? The MEAN aggregator using numpy.ma.average under-the-hood, which will produce this behaviour when NaN values are present in the input. Fore example
import numpy as np
import numpy.ma as ma
a1 = np.array([[1., 2., np.nan, 4., 5.]])
a2 = ma.array([[1., 2., 3., 4., 5.]], mask=[[0, 0, 1, 0, 0]])
print ma.average(a1, axis=1)
print ma.average(a2, axis=1)
which will print:
This seems consistent with your problem.
Since Iris pretty much assumes you are using masked arrays rather than NaN values to indicate missing values, my suggestion is that you first verify whether or not the data you are collapsing are contained in a masked array. Iris should always use masked arrays for data loaded from file (e.g. netCDF, GRIB) but it is possible to set the data of a cube manually to use a plain numpy including NaN values, which may occur in some user written analysis scripts. If you actually have a plain numpy array with NaNs you can convert it to a masked array with
import numpy.ma as ma
cube.data = ma.masked_invalid(cube.data)
There is a third option, which is a little more unpleasant to imagine, that is you have a masked array where some of the unmasked elements are actually NaN values... I'm not sure how this could arise but numpy does allow it. In this case you'd need to use masked_invalid also.
I think in general you should avoid NaN values when setting values contained in cubes, although there isn't a direct problem with this, a lot of the supplementary functionality assumes that missing values are indicated by masks and will break if NaN values are used instead.
Let us know how you get on.