A narrow vote paved the way for New Hampshire to possibly become the fifth state in the nation — and the third this month — to allow gay couples to wed.