In the absence of rent control, you're right. To stop a neighborhood from changing, you need both low density zoning (minimize incentive to tear down buildings) and ironclad rent control (make it impossible to dump existing tenants in favor of wealthier ones in existing buildings).
San Francisco has not managed the ironclad rent control part, and as you'd expect, landlords found various ways to get rid of low-rent tenants in favor of high-rent tenants. When you have the ability to drag your feet on repairs, the mechanism is obvious. When your tenants are poor and you're constantly forgiving them for being late/short with the rent, all you have to do is stop doing that.
Zoning by itself is just destructive. Zoning and rent control could theoretically work, though I'm not sure it ever has, because landlords are so much more clever about getting rid of tenants than cities are about designing rent control laws.