Toomey said he voted against the bill because Democrats would not consider his amendments to repeal pieces of President Obama's health law.
But he ultimately ended up in the same column as Cruz, and Democrats eager to unseat Toomey in 2016 seized on the vote as an opportunity to puncture his credentials as a pragmatist, calling his vote "radical" and "obstructionist."
"Sen. Toomey made it clear that he was part of the most extreme, tea party wing of the Republican Party," said a release from the Pennsylvania Democratic Party. "It is crystal clear: Sen. Toomey is a tea party senator who only gives lip service to moderation when he is in Pennsylvania then turns around and leads the tea party when he is in D.C."
Toomey also joined all Republicans in a losing effort to preserve a plan to defund Obamacare.
The procedural vote was a telling showdown within the GOP. Most veteran Republican senators urged votes to avoid a shutdown, while a largely younger, conservative bloc led by Cruz wanted to stall the spending bill in an uphill effort to kill Obamacare, even if it risked shuttering the government.
The upstart group, which included Toomey and Sens. Marco Rubio and Rand Paul, both rising GOP stars, lost in a 79-19 vote.
Toomey has long favored repealing Obamacare, but for months he has been saying Republicans should not risk a shutdown while pursuing that goal.
He instead argued for eliminating "the most egregious parts of this terrible law" and proposed three amendments: repealing a tax on medical device makers, erasing a rule requiring employer health coverage to include birth control, and delaying for a year the mandate that nearly all Americans have health insurance.
It was all but certain Democrats would block those ideas, and they did.
"Those three items all have bipartisan support, could have passed the Senate, and might well be acceptable to the House," a Toomey statement said Friday. "But we will never know because the Democratic leadership would not permit me to offer those amendments. For this reason, and others, I voted against the measure."
The result, though, put Toomey in the same column as a group of senators whose confrontational style has enthused the Republican base but angered others who oppose a shutdown.
Toomey, elected in a conservative wave in 2010, has had to strike a delicate balance between appealing to his allies on the right and reaching for compromise as Pennsylvania has edged toward the Democratic Party.
He recently backed a bipartisan deal to avoid the "fiscal cliff" and made national headlines by cosponsoring a plan to expand background checks on gun purchases.
The political impact of Friday's vote could depend on how this showdown ends. If it is resolved, voters will forget this vote, said Christopher Borick, a political scientist at Muhlenberg College.
But if a shutdown follows, Borick said, "and he comes out on the wrong side of that blame, this could be a vote he'll have to live with a long time."
Other local lawmakers took unsurprising stands.
Sens. Robert P. Casey Jr. (D., Pa.), Jeffrey S. Chiesa (R., N.J.) and Robert Menendez (D., N.J.) all voted to advance the spending bill past the procedural blockade.
Casey and Menendez supported an amendment to preserve Obama's health law and to approve to the resulting bill - both of which passed, 54-44, on strictly party-line votes.
Chiesa and Toomey voted against the amendment to save Obamacare and the final version of the bill.