when you merge vertices, check the options for the distance slider. the higher the distance is set, the further apart the 2 verts can be and still merge. Another command that can result in the same thing as that gif is to select the edge between the two verts you want merged and choose Edit Poly > Collapse.