Strictly speaking, it is not the hot water that breaks the glass, but rather, it is the sudden change in temperature that causes internal stress to be applied on the material. The sudden rise and fluctuation of temperature will break the glass immediately since glass is a terrible conductor of heat. However, if the rise in temperature is gradual, then the glass gets time to adjust slowly and will not break in the end.