Humor is based on surprise, and surprise is a milder way of saying shock. It's surprise that makes the joke.