The OH gets protonated and becomes a better leavinggroup and there is a electron pair on the nitrogen that can attack the carbon even if you dont pick the proton on the nitrogen. This way you get a positive charge on the nitrogen and then finaly the proton leaves the nitrogen.