There are several cases of vows with strange conditions in the Bible. Many of these are rash vows, often morally negligent or suspect. In Joshua 9, the Israelites make a covenant with Gibeon under the false pretense that they were from far away, when they had a command from God to wipe out any of the peoples of the land. Once they made the vow, they honored the covenant with Gibeon and didn't kill them rather than keeping the command of God to wipe them out. In Judges 11, Jephthah vows to sacrifice the first thing to come through his gate, expecting it to be an animal, and it turns out to be his daughter. In a very tragic move, he ends up fulfilling his vow and sacrificing her.
King Saul makes a similarly rash vow in I Samuel 14. He says that if any of his soldiers eat during their attack, they would be put to death. His son Jonathan wasn't present for that vow, and when he found honey in the woods he ate some. In this case, however, Saul's soldiers convince him not to keep the vow. You get the sense that he only did it because his men were able to calm him down and talk some reason into him.
In I Kings 2, Solomon makes a promise to Bathsheba to grant her a favor but then refuses once he finds out that the favor was to do something that would in effect give his older half-brother Adonijah a foothold toward claiming the throne that David had passed on to Solomon. Adonijah flees Solomon's wrath and in fact has him killed. Adonijah had already been spared once when he grabbed the horns of the altar, and Solomon had let him go on the condition that he shows himself to be worthy; otherwise, he'd die. His request to Bathsheba showed Solomon the latter.
In the gospels, King Herod makes a promise to his step-daughter that he'd give her anything, up to half his kingdom, and is shocked when she asks for the head of John the Baptist. He complies to save face but perhaps only for that reason.
It's worth thinking through the conflicting moral principles that arise in these cases. The most fundamental is the third commandment the third commandment (not to take God's name in vain), which Jesus interprets simply as a command to let your "yes" be "yes" and your "no" be "no". The third commandment says not to use God's name in a way that doesn't take into full account who God is and our place in God's universe. The most fundamental way that we can take God's name in vain is simply to ignore God, thus living in a way that ignores God is the most serious violation of the third commandment. This is especially important for a people called to represent God as his ambassadors to the world, since the representation is a fact, and thus representing God badly takes his name in vain and drags it through the mud. But uttering God's name when you don't have any intention of referring to God, particularly in a sinful act of verbal outrage over something not all that important. So the common view that using a name that normally refers to God in a sort of curse is indeed correct. It's a violation of the third commandment. It's just not the most fundamental way to do so.
Proverbs 6 says that if you make a rash promise that you later regret, you must approach the person and ask for a release from the promise. If they do not grant it, then you are obligated. The difficulty comes when the thing you agreed to would violate some other moral principle, especially if what it would violate is much more important than keeping your word. The case of Jephthah is pretty obviously in this category. He should never have made the view, but he certainly shouldn't have kept it under these circumstances. Saul's vow and Herod's promise seem similar enough.
On the other hand, Joshua's agreement with Gibeon seems to go the other way. The biblical narrator seems to endorse Joshua's decision to honor the covenant with Gibeon, even though it meant not keeping God's command to wipe out the inhabitants of the land. It was clearly a covenant they shouldn't have made. Honoring it clearly violated a command they'd been given by God. Surely a command of God is more important than an agreement with a human being, right? Well, the agreement with Gibeon was a covenant, and God certainly doesn't endorse violating covenants. So we have two principles conflicting, and it seems as if it's the rash covenant that wins out over the direct command of God, whereas the narrator in Judges and in I Samuel with Saul's vow would seem to advocate the other direction.
One way to resolve this would be to assume different moral theories lurking behind different narrators, but I don't see a need to appeal to that sort of thing. There need not be any inconsistency here. Jephthah, Saul, and Herod all involved murdering to fulfill a vow. Murder is worse than breaking a vow, and the vow is no excuse. With Gibeon, either choice is second-best to following God's original command, but breaking an agreement not to kill someone is worse than not completing the task of cleansing the land, primarily because that was an agreement that basically ensured God's protection on Gibeon. They represented God in making that covenant, and even though they made it in ignorance they still gave a promise from God that they needed to honor to uphold God's honor. God kept them to this even to the time of David.
What about Solomon, though? He made an agreement with Adonijah. He spared an already-forfeit life on the condition that Adonijah behave. Adonijah didn't behave. Solomon promised Bathsheba he'd grant the favor, but when he found out what it was he now knew that Adonijah had violated the earlier agreement and thus had warranted death. So the promise to Bathsheba was actually canceled by an earlier promise to Adonijah himself that he'd receive death if he refused to back down in his attempts to usurp David's choice for king.
So it does seem as if there's a coherent and plausible way to put these all together without postulating conflicting views behind different passages.