@diatint,
Two things.
1 - go back to training. As in, assume he doesn't know anything, and go about it from the beginning, again.
2 - clean the dirty area really,
really thoroughly. You and I cannot smell what dogs can, and it might look and smell clean but still smell like marked territory (which is, in part, what the visiting dog was doing) to your dog. And your dog wants to mark (even neutered dogs do this, but they do it far less than intact dogs do).
And, as always, it's exercise, discipline and affection.
Make sure your dog is getting out when he needs to. If he's going in the house, then he may not be getting walked enough. He's a little dog, so you don't have to go super-far, but get him off the property and out into the neighborhood (this is also how he becomes socialized). Praise him lavishly when he goes outside and pees and poos where you want him to. When he does, he is
the best dog ever.
As for discipline, there isn't a lot you can do unless you
catch him in the act of going inside the house. Yelling a firm
No! at the time that you see him lifting his leg or squatting is what you need to do. Don't hit and don't rub his nose in it - neither of these things work, and they're unnecessarily cruel. And disciplining him even 5 minutes after the fact won't work, either, as his mind has gone onto something else.
To sum up - get him outside for walks so that he has less chances (and less waste) to eliminate inside. Couple this with lavish praise and attention when he gets it right. He will catch on eventually. Get the area as clean as possible so that he doesn't get scent clues that tell him he needs to mark and cover up the other dog's markings. And discipline him firmly (but kindly), but only if you catch him in the act.