Diplomatic immunity just guarantees that certain high ranking officials will not be harassed, investigated on, detained or jailed, and they are assured safe passage back to their own country. It's not a blanket exemption from criminal liability.
Embassies on the other hand are deemed extensions of the territories of their counties, so the host country cannot exercise juristiction over the embassy of a certain country because they are just respecting the territorial sovereignty of another. For example, the Embassy of the US in Germany, the German government is powerless to arrest someone inside the embassy of the US because that area is deemed to be an extension of American territory.
If Asgard, while on Earth is given an embassy status, that just means the UN is respecting the territorial sovereignty of Asgard. Not that they are given diplomatic immunity per se. Regarding what Tony Stark said to Thor, I do not know what kind of clout he has that he can assure Thor such privilege that requires the consent of either the host country (which is the US, and any treaty or agreement can only be entered into by the Executive branch of government...aka the President, subject to Legislative approval in certain cases), or by the United Nations (which requires the concurrence of member states).