When zooming in and out Visio changes the grid size by default, it would be nice if it did this in powers of 2, so things would still be alligned on finer settings but no, it is fractional and changing zoom can move objects off the grid.
The simplest soloution is to use a fixed grid.
Viso -> Tools -> Ruler & Grid
Horizontal Grid Spacing = fixed
Vertical Grid Spacing = fixed
Horizontal Minimum spacing 5 mm
Vertical Minimum spacing 5 mm