Long answer warning. I did my PhD on scale-based measures of terrain slope, so can get quite excited about these things.Perhaps we should have a FAQ on this topic since it seems to occur quite regularly (with good reason I should add, so nothing wrong in asking the question).
There is no obvious "correct" height gain because there is no standard against which height gain should be measured. Imagine traversing a really bumpy profile, with ups and downs every cm or so. If you had a really accurate measuring device that recorded every single tiny bump in the road, this would give you a large total climbing figure since all those tiny bumps would soon add up.
If you had a coarser measuring device that recorded your height, say once every minute, it would miss out all those little bumps between recordings. So your total climbing figure would be much less.
The three sources you mention all record height at different frequencies. Depending on your settings on your GPS, that device will try to measure your height directly by triangulating satellite positions. If switched on it may additionally smooth things slightly using the barometric altimeter. This will therefore miss out some of the bumps you traversed on your route.
Memory map will estimate your height by comparing your position (either from the GPS track, or by input as a route on the map) with a database of heights - the Digital Elevation Model (DEM). I seem to recall that MemoryMap uses the OS 50m DEM which effectively means it records height every 50m travelled. This may well therefore capture more of the bumps of your journey than the GPS.
Other mapping software can use different DEMs, a popular one being derived from the Space Shuttle in the late 90s (SRTM). This DEM records height at roughly 100m intervals and tends to be smoothed quite a lot, so will give lower climbing figures.
There are other added complications such as the nature of the terrain, where the road is relative to the underlying topography, and the algorithms used by the mapping software and GPS for smoothing out errors. For example, I can easily double the height my GPS records on a 200km ride depending on what settings I use for recording position. Alpine type climbs that are long and steady tend to give more consistent readings with different methods than do undulating routes. All in all this gives a slightly uncertain picture of "true" climbing.
You could argue that the more accurate measure is the "better" one in that it more closely reflects the undulations on the road. However, small undulations are often not what we think of as climbing, and so measuring height less frequently can give a figure that is closer to our intuitive feeling of how "hilly" a ride feels. The question becomes therefore, at what level of detail should that be? My personal feeling is that the traditional Audax contour counting method from OS 1:50k maps is a pretty good standard. It also happens to be quite close to using a the OS 50m DEM. Both miss out the minor undulations that you'd get going over a railway bridge for example, but would capture the small hills you might get in a gently undulating lowlands.
This is probably more detail than you wanted, but just in case it is not, a few years back I did a small experiment on the accuracy of GPS elevation readings (on what is now part of the Olympic Park):
http://www.soi.city.ac.uk/~jwo/landserf/audax/elevation.html