Republican Pennsylvania U.S. Senate candidate Tom Smith, left, and U.S. Sen. Bob Casey, D-Pa. (Matt Rourke/AP)

Pennsylvania was not supposed to be on the political map this year.

Having gone for the Democrats in every White House contest for the past 20 years, the Keystone State was abandoned early by Republican presidential nominee Mitt Romney without a single dollar spent in the critical Philadelphia TV market. Usually a fiercely contested battleground in congressional races — the two parties spent $15 million on the airwaves fighting over three suburban districts here six years ago — the region has no competitive House contests this fall.

And Sen. Robert P. Casey Jr. (D), the scion of a political dynasty, was coasting toward re­election after a huge win in 2006.

But apparently no one told Tom Smith that Pennsylvania was off the grid. The coal industry executive has put $17 million of his own money into the Senate race, and with no competing ads on the air in Philadelphia for weeks, Smith, the GOP’s nominee, had a relatively free run at Casey until recently.

The first-time candidate pounded away at Casey as “Senator Zero” for his close relationship to President Obama, turning the letter “O” into a version of Obama’s campaign logo. Then came Romney’s strong performance in the first presidential debate, and in just a few weeks the Republicans have surged within striking distance of Casey and Obama.

Explore the 2012 Senate map and view unemployment and demographics

Now, outside interest groups are considering ad buys in the Senate race, which remains a long shot but might be the only chance Republicans have of securing the majority, given their stumbles in other Senate contests. Additionally, Romney’s campaign dipped a toe back into Pennsylvania on Saturday when his running mate, Rep. Paul Ryan (Wis.), held a rally with Smith at Pittsburgh’s airport — the first time Ryan or Romney had been in the state in almost a month.

On Sunday, Romney officials said that they were intrigued by the state but that no final decisions had been made on whether to finance ads here. Because of Pennsylvania’s restrictive absentee-voting rules — more than 95 percent of ballots will be cast on Election Day — officials said they are leaving open the option of a final sprint of ads.

Most local experts predict an Obama win, but with a smaller margin than his 10-percentage-point victory in 2008. Nonetheless, Pennsylvania is suddenly relevant again, and that’s why the Obama campaign dispatched top surrogates last week to give pep talks to workers and volunteers engaged in a final effort to turn out voters.

On Wednesday evening, Joshua Shapiro, the new chairman of the Montgomery County Commission, made the rounds at several offices in Philadelphia as well as in his county, a critical suburban stronghold for Democrats. At his last stop, Shapiro added a plug for Casey, a recognition that the senator could be in trouble. “The key for the president, and for Senator Casey, is here in the suburbs,” he told volunteers in Elkins Park.

Shapiro, 40, the first Democratic chairman in the 140 years that Montgomery County has been incorporated, is a symbol of why Pennsylvania has become such fertile ground for Democratic presidential campaigns. Once a bastion of “Rockefeller Republicans,” the county has voted Democratic in every presidential contest since 1992. Shapiro’s victory in 2011, giving his party its first majority on the three-member council, caught the attention of Obama campaign manager Jim Messina, who summoned Shapiro to Chicago this year to discuss how he won in the suburbs.

The question now, for Obama and Casey, is whether the suburbs have soured on the incumbents. In 2008, Obama won the four large suburban Philadelphia counties — Montgomery, Delaware, Chester and Bucks — by 200,000 votes, including an 80,000-vote margin in Montgomery. Combined with his 480,000-vote edge in Philadelphia, that made Obama unbeatable in the state. Casey, in his 2006 rout of an unpopular incumbent, Rick Santorum (R), also won the southeastern corner by more than 2 to 1.

Republicans, however, believe they have a path to victory in GOP Sen. Pat Toomey’s win in 2010. Toomey captured just 16 percent of the vote in Philadelphia, but he won Bucks and Chester counties while running competitively in Montgomery. He won big in the part of Pennsylvania that locals call “the T”: the rural area in the middle of the state and into the far northeastern and northwestern corners.

“Pennsylvania’s always been in play, in my opinion,” Smith said in a recent telephone interview after campaigning with Ryan. “It’s pink now, turning red.”

Smith was not the first choice of top Republicans here, including Gov. Tom Corbett (R), who supported a different candidate in the April primary. Unknown in the southeast, Smith poured $2 million into the Philadelphia media market in August and September as Casey’s campaign held its powder in the expensive market until two weeks ago.

One poll, from Quinnipiac University, showed the two candidates statistically tied in the southeastern suburban counties, as Casey clung to a three-point lead statewide. His campaign released an internal poll from Friday showing the senator ahead by 52 percent to 39 percent. His image as a candidate willing to defy his party on key issues — Casey opposes abortion rights — has the senator receiving more support than most Democrats in the traditionally conservative regions.

Casey was clearly caught off guard by Smith. It’s difficult to find a “Casey for Senate” lawn sign in eastern Montgomery County. At the Obama campaign office in Elkins Park, visitors are greeted with literature for the president, the nominee for state attorney general, the local congresswoman and two candidates for state representative — but nothing for Casey.

At a recent Casey event at an electrical workers union hall in Allentown, supporters hounded the senator and his staff for campaign literature and lawn signs, handing over contact information to receive campaign staples.

“We can finish strong,” Casey said in an interview, noting the difficulty of running as an incumbent during tough economic times as opposed to six years ago against an unpopular Santorum.

Casey finally began running an ad that links Smith to the Senate conservatives who would overhaul Medicare and Social Security, a key issue for a state that has one of the nation’s oldest populations. “This isn’t just a one-liner. They are deadly serious,” Casey warned supporters.

The aim is to define Smith as a fringe member of the tea party movement. Just as Messina tried to learn from Shapiro’s Montgomery County victory, Casey is using similar themes. His ads end with a picture of Smith on a teacup, under the label “Tea Party Tom Smith.”

The same admaker ran a similarly hard-hitting spot for Shapiro in 2011, and if the Obama campaign suddenly decides that Pennsylvania is back in play, it probably will use the same themes against Romney.

Once touted as someone who would help the president in other parts of the state, Casey may need to draft Obama’s vote-getting operation in the southeastern corner for both incumbents to win. As Shapiro told Obama volunteers last week, they need to come close to replicating those large margins in the city and suburbs. “Every extra Obama vote we get here is going to make the difference,” he said.