The original manuscript initially had the preposition of, as did the printer’s manuscript. In 𝓟, Oliver Cowdery replaced the of with by—and without any change in the level of ink flow for the supralinear correction. In 𝓞, Oliver also replaced the of with by, but there the ink flow for the supralinear correction is considerably heavier; in addition, the quill that Oliver used for the correction appears to have been somewhat duller. The distinct difference in ink flow argues that the correction in 𝓞 took place later, probably when Oliver copied the text into 𝓟. In other words, the change to by appears to be editing on Oliver’s part.
The phrase of being postmodifying a noun is found elsewhere in the text (but there are no other examples of by being in the Book of Mormon):
Notice that in both these examples the head noun is preceded by the definite article the (that is, “the office of being high priest” and “the fear of being slain”). These two examples suggest that in Alma 51:31 the indefinite article a in the earliest reading (“with a disappointment of being repulsed”) may be an error for the:
𝓞 is extant here and clearly has the indefinite article a. Note, however, that an original the (which begins with the voiced interdental /d/) would have been preceded by with (which ends in an interdental fricative, either /h/ or /d/). In other words, Oliver Cowdery could have misheard Joseph Smith’s with the as with a.
Ultimately, the earliest text here in 𝓞 for Alma 51:31 is not especially difficult. Despite the strangeness of “a disappointment of being repulsed”, the critical text will follow the original reading in 𝓞 with its indefinite article a and the preposition of. The correction of of to by in 𝓞 appears to be secondary.
Summary: Restore the original preposition of in Alma 51:31: “he met with a disappointment of being repulsed by Teancum and his men”; when Oliver Cowdery copied the text from 𝓞 into 𝓟, he decided, it would appear, to emend the of to by, a reading which is not supported elsewhere in the text (but of is); there is also a possibility that in 𝓞 the a before disappointment is a mishearing for the.