I think that highly depends on where the battle takes place. The Dark Dimension is completely controlled by Dormammu (in fact, it's fairly ambiguous if Dormammu is just another name for the Dark Dimension), meaning that Thanos is fighting against someone who's free to alter the rules of the dimension at will. In effect, Thanos would be playing against a stacked deck. So unless Thanos can find the equivalent of a "brain" or a "heart", like that of Ego, I don't think even he would be able to defeat an entire dimension with only 5 infinity stones. However, if Thanos were to somehow get Dormammu out of the Dark Dimension (which for the same reasons above might not even be possible), I think he would definitely make quick work of Dormammu as it appears that the majority of Dormammu's power comes from the Dark Dimension.
This is all highly theoretical, of course, because we don't know what powers Dormammu would have obtained should Dr. Strange have given him the Time Stone. We don't even know if there would be any reality outside of the Dark Dimension left. Dormammu's goal is to devour every planet, and with every planet he devours, his power would grow stronger (as there would be more of "him" around to fight with). The only way we know for certain that Dormammu can be "beaten" is by essentially boring him so much that he leaves. We don't even know if he can die, or be defeated in the traditional ways.
PS: I don't see a reason why Thanos couldn't use the Space Stone to travel to the Dark Dimension if he so desired.
TLDR: Unless Thanos can find a way to defeat an entire dimension (made stronger by an Infinity Stone), I think that it's highly likely that Thanos would probably have opted to try to bargain for the stone, or perhaps just continue his quest of annihilation with the five stone he has. The last thing Thanos would want to do is fight Dormammu on his own turf.