The Shah was kicked out mainly because he was a poor micro-manager (I think the lack of onions in the shops being the LAST straw), I can see the lower and middle class of Tehran turning against the current powers if they think this foolish attempt to build nuclear weapons again causes them to do without.
Nah, that's very unlikely. The powers-that-be will simply cast the hardships as foreign oppression and position themselves as the champions of resistance to such. This being exactly the game they've played since the 1980's, after all, and I see little reason it wouldn't work this time.
There's also the fact that Iran just successfully crushed an uprising, and so has both a credible system of authoritarian repression and a somewhat dispirited and scattered opposition.
Japan against the US comes to mind.
Yeah that's probably the best example. Although, that was a context in which oil sanctions by a few Western powers meant that Japan couldn't access fuel to run its economy, and so was more like a hostile blockade, than the sort of sanctions programs we see in the current day.
But Iran does not have the military might Japan did back in 1941 and so who would Iran attack?
Like Japan's position in East Asia in the late 1930's/early 1940's, Iran is qualitatively more powerful than any of its neighbors. One of the things that keeps the whole "Shiite Crescent" model of Iranian regional supremacy alive in the minds of various players is that it is basically credible: those nearby Shiite populations inhabit states with pathetic military capabilities, and are sitting on top of strategic oil deposits.
Of course, unlike WWII, any moves against such states would immediately trigger a military confrontation against the US, which Iran can ill afford, but the potential for militaristic and ideological expansionism is present in the regional geopolitical dynamics (i.e., excluding global influences like the USA).
Clearly starting a war against the US is not something that Iran reallys want to do.
Or even, getting into such a war even if they didn't start it. We can debate what the consequences might be for the USA and everyone else, but it's pretty much guaranteed to be a losing proposition for the powers that be in Tehran.