The gemara (Sukkah 53) relates then when David dug the shitin drainpipes for the mizbeyach, the waters below started coming up through the drains and threatened to flood everything. David thought of a solution: write the shem Hashem on a piece of earthenware and throw it into the drain to stop the water. However, he did not know whether it would be permissable to erase shem Hashem to do this or not, so he announced that anyone who knows the answer should come forward. Continues the gemara:
נָשָׂא אֲחִיתוֹפֶל קַל וָחוֹמֶר בְּעַצְמוֹ: וּמָה לַעֲשׂוֹת שָׁלוֹם בֵּין אִישׁ לְאִשְׁתּוֹ, אָמְרָה תּוֹרָה: שְׁמִי שֶׁנִּכְתַּב בִּקְדוּשָּׁה יִמָּחֶה עַל הַמַּיִם, לַעֲשׂוֹת שָׁלוֹם לְכׇל הָעוֹלָם כּוּלּוֹ — עַל אַחַת כַּמָּה וְכַמָּה. אֲמַר לֵיהּ: שְׁרֵי.
Achitofel drew a kal v'chomer: if to make peace between husband and wife the shem Hashem can be erased, as we read in the parsha of sotah, certainly it can be erased to make peace for the whole world.
In the Reshimos Shiurim, R' Soloveitchik is quoted as learning from here that the din of mechikas Hashem by sotah is dechuya, not hutra.
מכאן מוכח דהא דמוחקין את השם בסוטה אינה מדין הותרה אלא מדין דחויה, שיש במחיקת השם מעשה איסור אלא דשלום בית דוחה את איסור המחיקה, דהא יליף אחיתופל לכל התורה כולה מסוטה, דאילו הותרה למצות סוטה איך אפשר ללמוד לשאר התורה.
Were mechikas Hashem hutra just for the sake of sotah, then that would preclude generalizing from there to other cases. It must be that there is an issur of mechika even in the sotah case, but the need for shalom pushes it off. Therefore we can generalize to other contexts.
RYBS brought further proof from the last Rambam in Hil Chanukah:
היה לפניו נר ביתו ונר חנוכה או נר ביתו וקדוש היום נר ביתו קודם משום שלום ביתו שהרי השם נמחק לעשות שלום בין איש לאשתו. גדול השלום שכל התורה ניתנה לעשות שלום בעולם שנאמר דרכיה דרכי נעם וכל נתיבותיה שלום
Rambam learns that just like for the sake of shalom the issur of mechikas Hashem is pushed off, so too, for the sake of shalom lighting shabbos candles takes precedence over kiddush. Again, we see the principle derived from sotah being generalized to other instances.
Afar ani tachas kapos raglav, but I think the Shu"T haRama (100:10) learns differently. Rama quotes a teshuvah from Rav Hai Gaon: a husband took an oath to divorce his wife. Can the husband violate his shevu'a for the sake of shalom bayis and remaining married? Rav Hai Gaon responded that he may not. This case is not comparable to the parsha of sotah, Rav Hai somewhat cryptically explains, because there violating the issur of mechikas Hashem is 'motzei mi'dei safeik u'mi'dei issura,' but here, with respect to shevu'a, there is an issur of 'lo tisa."
What exactly is the chiluk Rav Hai is making between the two cases? Rama explains that the issur of mechikas Hashem is derived from, "lo taasun kein l'Hashem Elokeichem...," not to destory our holy things the way avodah zarah must be destroyed. The issur of mechikas Hashem, he writes, only applies when done with a destructive intent. However, if done for a constructive purpose, e.g. shalom bayis, there is no issur.
Were shalom bayis **doche** the issur of mechikas Hashem, then shalom bayis should be doche the issur of shevu'a as well. Rama says this equation does not work because the issur of mechikas Hashem is **hutra**, i.e. there is no issur when done for a constructive purpose. This does not apply to the issur of shevu'a, which has completely different parameters. Achitofel could generalize from sotah to his scenario because he was dealing with the same issur of mechikas Hashem done for a constructive purpose.
The proof from hil chanukah is not convincing to me because in that case we are speaking about a din derabbanan of ner shabbos taking precedence over other dinim derabbanan like drinking wine for kiddush, or ner chanukah. There many takanos derabbanon instituted for sake of darkei shalom, so it's no surprise that one derabbanan would outweigh another for that reason.
I saw quoted b'shem R' Elyashiv a different pshat in this Rav Hai Gaon. R' Elyashiv suggested that the woman involved suffers tremendous embarrassment by being put through the sotah process to determine her guilt or innocence. This is why the Torah promises that if indeed she is innocent, meaning she did not have relations with a stranger, she is rewarded and will have a child. Eevn though she is not truly 100% innocent -- she certainly violated the issur yichud -- the great burden of embarrassment inflicted upon her demands some compensation. Davka in this instance, where a woman's reputation is on the line, when she is suffering great pains of shame, the Torah allows shem Hashem to be erased. This is far beyond the normal bounds of ordinary shalom bayis, and therefore, one cannot generalize from here regarding shalom bayis being doche other issurim.
I only saw this quoted second hand in a parsha sheet, but it seems to me that it leaves unresolved how Achitofel could derive anything from the parsha of sotah given that the heter mechikas Hashem there is unique to the special circumstance involved.