Psychologically what Mesha accomplished was showing his resolve was stronger than that of his enemies by consecrating the battle as a 'holy war'(source)
Spiritually speaking, in Sanhedrin 39b your question is addressed
“Then he took his eldest son, who should have reigned in his stead, and sacrificed him for a burnt offering upon the wall; and there was great indignation against Israel, and they departed from him and returned to their own land” (II Kings 3:27). Rav and Shmuel engage in a dispute concerning this. One says: The king sacrificed his son for the sake of Heaven, and one says: The king sacrificed his son for the sake of idol worship. The Gemara asks: Granted, according to the one who says that he sacrificed him for the sake of Heaven, this is as it is written: “And there was great indignation against Israel,” as the gentile attempted to honor God according to his understanding, while the Jewish people were straying from worshipping God, leading to God’s anger against them. But according to the one who says that he sacrificed him for the sake of idol worship, why would the verse state: “And there was…indignation”? The Gemara answers: This can be understood in accordance with the statement of Rabbi Yehoshua ben Levi. As Rabbi Yehoshua ben Levi raises a contradiction: It is written concerning the Jewish people: “You have not walked in My statutes, neither have you kept My ordinances; nor have you done according to the statutes of the nations that are round about you” (Ezekiel 5:7), and it is also written: “You have done according to the statutes of the nations that are round about you” (Ezekiel 11:12). Rabbi Yehoshua ben Levi explains: You did not act like the proper ones among the nations, but you did act like the flawed ones among them. Here as well, the Jewish people learned from the king of Moab to engage in human sacrifice. The Gemara discusses the end of that verse: “And they departed from him and returned to their own land [la’aretz]” (II Kings 3:27). Rabbi Ḥanina bar Pappa says: At that time the enemies of the Jewish people, a euphemism for the Jewish people themselves, descended to the lowest level.
To extrapolate (and add my own interpretation) verses 18-19 were in fact fulfilled, Moab was given into the hands of the Jewish army and that army did fell the trees and stop up the water. There is no indication that Moab was militarily successful again Yisrael in this war. However, the prophecy did not state that Moab would be completely wiped out. Once Mesha performed this sacrifice it either provided him with more merit, even though it was perhaps not what God 'wanted' the intention behind it was noble. Or, it cast the merit of Yisrael in doubt.
Perhaps in this situation we can apply the concept of שמא יגרום החטא that even though there was a positive prophecy it need not come true in the most positive possible way.