The vote, on Day 41 of the shutdown, signaled an end in sight to weeks of gridlock. Eight members of the Democratic Caucus supplied the critical backing.