Mack and his friends' quest to throw a party for Doc is not just an important plot point in Cannery Row—it's also an allegory embedded within the story. The first party goes awry when the gang throws it at Doc's lab before he even gets home, leaving him with nothing but a mess by the time he gets home. The mishap is marked by this moment of situational irony:
Through the broken end of the packing case a frog hopped and sat feeling the air for danger and then another joined him. They could smell the fine damp cool air coming in the door and in through the broken windows. One of them sat on the fallen card which said “Welcome Home, Doc.” And then the two hopped timidly toward the door.
In order to secure the funds to throw Doc his party, the boys catch a large order of frogs to sell to Doc, planning to use the money they get from him to organize the event. The irony of the situation is that the frogs Doc needs never actually make it to him, as the boys use the frogs as currency at Lee Chong's to buy liquor and decorations (Lee Chong accepts this, knowing he can simply sell the frogs back to Doc). Instead of simply giving Doc the frogs in the first place, the boys deprive Doc of what he actually needs in order to show him "kindness" in a way that will directly benefit them. To make matters worse, they destroy Doc's lab in the process. The image of the frogs hopping away across the wreckage of discarded decorations underscores the humor and absurdity of the scene. In trying to do something nice for Doc, they interfered with his ability to actually get what he needed and ultimately made his life harder.
The story of Doc's party-gone-wrong serves as a kind of allegory about good deeds. The situation teaches the boys an important lesson about "goodness"—that what seems kind and giving at first can actually be self-serving and destructive.
In Chapter 25, the narrator remarks that the Cannery Row community feels a sense of impending doom, their reaction to which is introduced with this instance of situational irony:
It’s all right not to believe in luck and omens. Nobody believes in them. But it doesn’t do any good to take chances with them and no one takes chances. Cannery Row, like every place else, is not superstitious but will not walk under a ladder or open an umbrella in the house.
Clearly, this passage is full of contradictions. The narrator asserts that it is just as unwise to believe in luck and omens as it is not to believe in them, and the narrator also reveals that Cannery Row residents are not superstitious but nonetheless partake in many famous superstitions (in this case, avoiding walking under a ladder or opening an umbrella inside).
But Cannery Row is a book about human contradiction. Steinbeck's goal with this ironic passage is to demonstrate that humans are essentially contradictory beings that defy the logic and order we love to ascribe to our lives. It is entirely possible and reasonable, Steinbeck argues, for a person to be both superstitious and not, just as it's reasonable for a person to be both kind and evil, both selfish and giving, both perceptive and obtuse. All of the characters in Cannery Row embody this ethos.
After Gay does not return from his quest to get a replacement part for Lee Chong's Ford, it is revealed that a chaotic chain of events landed him in jail in Salinas. His jailbreak to attend Doc's party in Chapter 27 is an example of situational irony:
Gay heard about the party clear over in the Salinas jail and he made a deal with the sheriff to get off that night and borrowed two dollars from him for a round trip bus ticket. Gay had been very nice to the sheriff who wasn’t a man to forget it, particularly because election was coming up and Gay could, or said he could, swing quite a few votes.
The irony of this situation is that, while the point of a sheriff's job should be to enforce order and ensure that the community is shielded from all manner of harm and chicanery, this sheriff is instead letting Gay bribe him into setting him free. This instance challenges common and stereotypical assumptions about vice and virtue—a project of Cannery Row in general.
It's also important to note that Gay himself complicates the dichotomy of vice and virtue consistently throughout the story, including here. He is a complex character that does both a lot of right and a lot of wrong—sometimes the right thing for the wrong reasons, or vice versa.