Iron Man uses his ingenuity and advanced technology to outsmart Thanos. He comes up with a clever plan and deploys some powerful weapons and strategies.
In the comics, Thanos defeats Iron Man through a combination of his strength, energy blasts, and strategic planning. It's a fierce and intense confrontation.
Thanos could also win in a fanfiction. He has incredible strength and the power of the Infinity Stones at his disposal. In a lot of fanfictions, the power levels are often exaggerated. Thanos could simply use the Reality Stone to make Iron Man's weapons ineffective or use the Time Stone to freeze Iron Man in time and then defeat him. His brute strength alone is enough to overpower Iron Man in a direct confrontation. And his experience in battles across the universe gives him an advantage over Iron Man who mainly operates on Earth.
Perhaps Thanos stabs Iron Man, but it's part of a bigger plan by Iron Man himself. He could have anticipated Thanos' move and allowed himself to be stabbed in order to get close enough to Thanos to plant a powerful device. This device might be something that could disable Thanos' powers or even send him to another dimension.