This is an interesting way to put it. Good question. We can, indeed, look at the "Gift of the Magi" as a story within a story. The larger story is the story from the New Testament when the Magi came to the baby Jesus to offer their gifts of frankincense, gold, and myrrh. They gave and showed their wisdom, because they recognized who was born, the king of kings who would deliver people from their sins (according to the New Testament).
Jim and Della show the same dynamic of sacrifice and wisdom. Jim sells his watch for combs for Della's beautiful hair, and Della cuts her hair and sell it for a chain for Jim's watch. In the end, they have gifts they cannot use, but they have shown sacrifice, generosity, and love in the process. They outdid one another. By this they proved to be wise. It is always wise to sacrifice.
O. Henry actually makes this point:
The magi, as you know, were wise men--wonderfully wise men--who brought gifts to the Babe in the manger. They invented the art of giving Christmas presents. Being wise, their gifts were no doubt wise ones, possibly bearing the privilege of exchange in case of duplication. And here I have lamely related to you the uneventful chronicle of two foolish children in a flat who most unwisely sacrificed for each other the greatest treasures of their house. But in a last word to the wise of these days let it be said that of all who give gifts these two were the wisest. O all who give and receive gifts, such as they are wisest. Everywhere they are wisest. They are the magi.