It's true that both parties poured buckets of money into that race, but one would expect that Murtha's legacy would be too much to overcome. Combine that with a 33% approval rating for Obama in that district, and it becomes even more baffling. The district voted for McCain last election cycle, though it pulled for Kerry in 2004. But they also re-elected Murtha as some of his controversies were coming to light last cycle.
This district was seen as a bellweather for the November mid-terms, but I think that may be overrated. Elections are finicky, and they frequently don't predict much. But that doesn't mean losing this seat isn't painful.