^that's just it, it's a bullshit threat. it produces no bargaining power at all.
it's like going to market and haggling with a vendor by threatening to pull the pin on a grenade. is the discount on the item you're haggling for worth more than your life?
Well, it depends. As you said, going to the market and trying to haggle down the price with a vendor under thread of mutual destruction doesn't work.
But if you're heading home from the market and someone threatens to kill you, the possibility that such an act would also result in the death of everyone involved could be a deterrent.
To move away from trying to fit theory into badly formed analogies: Iran has very little incentive to use such a weapon offensively. The only time that worked was in the end of WWII, and that was due to some highly specific circumstances (nukes being considered "bigger, better bombs" at the time, nuclear usage being restricted to one nation, and everyone being more or less pissed off at the target). Nowadays, any nation that decides to be the first to start tossing around nukes faces the very real risk that other large, powerful nations that have nukes will consider them a real threat and act appropriately. The result is very likely to be the destruction of the nation that decided to use nukes first.
Nukes only make sense in a defensive context. If a nation is already facing destruction, then using nukes is rational (any odds are good odds for the damned, after all). Since such an action is foreseeable, such a nuclear arsenal serves as a deterrent. Sure, there can still be conflict and war, but there is a very real deterrent to not have the goals of such conflict be the destruction of the nuke-possessing nation.
A non-nuclear example of this would be South Korea. It's small enough that a surprise attack by the north could have a very real chance of overrunning the country, leading to the destruction of South Korea as a nation. But such an attack is very likely to draw in the might of the US and the resulting destruction of North Korea as a nation. So, assuming NK's leaders don't have their heads up their asses (which is a pretty big if), such a surprise attack is deterred by the threat of total destruction. Saber rattling still occurs, with violence happening in border regions. But such saber rattling has a strong incentive to stay at a level below that of widespread war in the peninsula. (South Korea also has a strong incentive not to take North Korea out - not only would such a war be disastrous economically to South Korea, but China serves a similar role to the US, but for North Korea.)