The story is tragic in part because he expected an animal, but also because his vow reveals his lack of faith in God.
The parable of the Friend at Midnight does not promise that God will meet our every need or give us everything we ask for. Instead it teaches that God will give us the ultimate gift: righteousness.
These two parables in Luke 18 (The Widow & the Unjust Judge and the Pharisee and the Tax-gatherer) deal with prayer. But the underlying theme is how we achieve justification.
Why should I have confidence that God answers my prayers? According to James, I have confidence that my prayers will be answered because of who is answering my prayer, not because my prayer is perfect, powerful or articulate.