The Democratic candidate won in the PA-12 election because the Democratic turnout was higher than usual due to the high-profile, hotly-contested statewide primary election between Sestak and Specter.
Pat Toomey is already the GOP nominee for the U.S. Senate race, so there was no comparable high-profile statewide race to bring GOP voters out.
It's also worth noting that Pennsylvania has a "closed" primary system, so independents weren't involved in the primary election anyway and therefore had less incentive to show up for the PA-12 election.
Did you know this. I didn't. Sure puts a different light on Tuesdays results in PA-12