On Makkos 23b, Rabbi Elazar quoting Melachim 1 3:27says that in three places, the Divine spirit made an appearance. Bereishis 38:26, Shmuel 1 12:3-5 and here. It was a divine voice that said “she is his mother”. The Gemoro cannot prove this, but maintains it is known by tradition.
What was so special about Shlomo’s wisdom? Why was everyone so impressed in v.28?
Before addressing your question please see the next chapter, Melachim1 chapter 5- verses 9 thru14, where it describes some of the extent of Shlomo’s knowledge. Shlomo proved his knowledge a thousand times over, and it was evident in everything that he did and the books that he wrote. This story that is being told was only the opening realization that the people had to his wisdom. However Regarding your question, the Maharsha on the page asks your question, and he explains the gemora, that Shlomo said what he said and he ruled what he ruled. However the gemora asks, maybe the proof that Shlomo had was also staged and really the other woman was the real mother? To this the gemora answers that, everyone saw Shlomo’s wisdom, because the divine voice agreed to him, not that it said it instead of him, but it agreed with what he said.