Following a long election night, Mainers needed a good laugh and, as luck would have it, here came one of today’s top comedians to make it happen.

Fresh from hosting “Saturday Night Live,” Louis C.K. came to Portland on Wednesday night to perform for a capacity audience at Merrill Auditorium. The red-haired comic said he had played Portland before, but at much smaller venues.

A good deal of C.K.’s humor these days is within a sort of high-road/low-road context. He referred to the rational and reptilian sides of the human mind and how our morals can sometimes be quite “malleable,” depending on the situation.

A highlight of his 80-minute set was a hilarious bit based on a way of thinking that he called “of course. … but maybe,” which brought out some politically incorrect attitudes that are usually kept only as private thoughts.

Perhaps best known for his semi-autobiographical sitcom called “Louis,” the comic is taking a little time off from that show. He noted that his success has allowed him to move into a fancy New York condo. Now, he fantasizes about confrontations with neighbors who are really quite nice.

He sees an elderly woman walking an old dog that he describes as “misery on a rope” but hopes that it outlives its owner, who would be devastated by the loss.

He sees marriage as the necessary suffering that leads to the much better state of being divorced. No one ever complains that their divorce is breaking up, he noted.

The dark thoughts that sometimes come over stressed-out parents lead him to elaborate fantasies of getting even.

But, in the end, the burly 45-year-old comic assures us that “it gets better,” particularly if you recognize that your target weight should be as heavy as you get from eating whatever you want.

Of course, getting out of a chair at his age can be like trying to get a “Chevy out of a snowbank.”

C.K. (real last name Szekely) has cited the late George Carlin as being among his early influences. He certainly favors Carlin’s interest in breaking down taboos built up around language and private behaviors (many of C.K.’s lines cannot even be paraphrased in a family newspaper).

Perhaps because of a more self-deprecating style, C.K.’s edge seems a lot less cutting and squirm-inducing, though, than many other comics who test the limits of propriety.

Comic Gary Gulman, from Boston, opened the evening with a brief set. He made the only political reference of the night when he said he was not better off than four years ago but it was entirely his own fault.

He also amusingly revealed the condescension implied in most containers of French yogurt.

It was a fun night at Merrill.

Steve Feeney is a freelance writer who lives in Portland.