In a legal marriage a mahr (dowry) is necessary and it can be delayed -even if this was not the usual practice in early days of Islam AFAIK- with different conditions according madhhabs and views.
What if one of the spouses died while the husband has not paid his mahr yet. My understanding is that mahr is a due of the husband at least once the marriage was consummated -whatever this may mean-? I'd assume that the dowry would be given the wife if alive (or her inheritors if not) before dividing the heir.
What if it is actually the husband who died and the heir doesn't reach the amount of the declared mahr?