The mercury rises because it expands as it gets hotter and the only way it can go in the glass is up.
It dips initially because the heat of the water gets to the GLASS first [as this is the first thing it comes into contact with], causing the glass itself to expand. The expanded glass means there is more room for the mercury to sit in at the bottom of the thermometer. The mercury level falls because some mercury is filling the new space created from the expanded glass.
The heat quickly gets to the mercury however, which begins to expand and therefore rise, giving the normal thermometer behaviour you expected.
In a nutshell:
a) Glass heats up first and expands, mercury dips slightly.
b) Mercury is heated soon after, expands and rises.