He'd only worry about connections being exposed if someone could prove wrongdoing in a court of law, and he knows that would be difficult to do--both because much of the evidence is not easily obtained (some of it buried in the files of his wife's CIA unit where even a Senate subcommittee found difficulty getting at it, some of it in African countries controlled by the French and not subject to US jurisdiction) and because his political friends (Al Gore, Brent Scowcroft, the Saudis, etc.) have powerful legal connections--so he figures he can get away with it, as he did when Clinton was President. It may also be he's not in a position to say no to his handlers. And it's obvious he likes the negative attention he gets from sticking a thumb in George Bush's eye.
Espinoge isn't really legal at all. Almost all of the activities of espinoge are explicitly illegal. The question is politics. Does the chief law enforcement officer have the evidence or the will to pursue the investigation?
Iran-Contra was almost impossible to investigate because the banks were so deep in the game it became a US national interest NOT to see the feds close in on the banks. US Banks were looking to enter new energy rich markets such as UAE, Pakistan, etc. What's often in the interest of US enterprise is also becomes the interest of the United States. The same is true for France, Russia, China, etc. Helping to make your commerce more valuable is closely tied to making your citizens more valuable.
I do not know whose interests Joe Wilson was representing in Africa during his trips. The CIA doesn't always dispatch officers for the United States. They also have key interests in maintaining relationships with other political entities with power -- Russia, France, China, etc. The CIA may have been trying to obtain information to help the espinoge activities of another country like France in dispatching Wilson and other officers to Niger.