Philadelphia voted Republican in the 1946 Gubernatorial and Senatorial elections, FWIW.
Republicans won all of the Philly Congressional seats in 1946 as well, though a number of them did flip back in 48.
Any idea what changed in Phily's politics between 1948 and 1952?
The downfall of the Republican city machine and its replacement by as yet unbroken Democratic dominance. The Mayoralty flipped in 1952 by about 100,000 votes if memory serves me and the Democratic mayor Joseph Clark went on to become a Senator for two terms from 1957 until 1969. I think a big culprit is generational change and demographic shifts post New Deal finally caught up to the Republican machine and caused it to collapse. There was also internal corruption and other standard issues that tend to cripple machine operations in time.
So in 1948 the Republican machine managed to make the city vote close against Truman, but in 1952 the dominant Democratic machine managed to deliver Stevenson a 15 point win despite the national swing? Did the Democrats in 1952 manage to turn out a lot of previous non voters? Since Ike had a raw vote 30k less than Dewey, were there some Dewey-Stevenson voters for whatever reason?
Think about who the candidates were and their backgrounds and then think about how that would appeal to say:
1. African-Americans
2. White Ethnics
3. WASPs
4. Jewish Voters
Truman did well with many of these voters in most places but it is possible that him being a border state bumpkin enabled the GOP machine to pull off one last hurrah "almost" against him.
Compared to the egg head Stevenson who was if anything ahead of his time in terms of the New Deal and what the New Deal was doing in terms of College Educated Urban WASPs (Kevin Phillips talks about this liberalization process of Urban WASPs as well as the diversification of that group post New Deal and post war). Combine that with FDR legacy among unions, continued strong support among African-Americans and possibly localized improvement with Jewish Voters (if the machine still had some influence there in the 40s).
Its not so much that a new machine replaced the old over night, but a new electoral paradigm washed the machine away and helped carry Democrats to victory city wide in 1951. Subsequent White Flight would then push the city to become solidly Democratic and the Democratic machine with its own corruption would take shape once most of the reformers had moved on to other positions by the mid 60s.
https://en.wikipedia.org/wiki/1951_Philadelphia_municipal_election#MayorThough it should be stated that Republicans came close to winning Philly in 74 for Senator, with Schweiker under 4,500 votes away from winning the City, and Specter outright won the city in 1980.