This is true but consider this. If the impeller is not attached to the shaft properly it could be that it spins fine at higher revs but slips on the shaft at tick over.
To the OP. Next time it does it try revving it up a bit and see if the temp drops. If it does I would look into a faulty water pump. If it doesn't you could try fitting a new thermostat.
i will try this if it does it again, i was wondering thermostat but if it was that would it not be getting to temperature on the gauge?