Mr. Krabs is very cranky one morning after throwing out his back due to his old, lumpy mattress. SpongeBob suggests that he and Squidward buy Mr. Krabs a new one, but because he does not want to waste his hard earned money on his cheapskate boss, he refuses, so Patrick joins SpongeBob in buying a new mattress instead. The two go to a massive mattress emporium, where they buy a comfortable new mattress throw out his old one.
They make a card for him, which Squidward signs, giving himself full credit for the gift. The next night, the trio surprise Mr. Krabs with his new mattress, and when they tell him that they threw away his old one, he is furious, revealing that all of his money was in the mattress. He throws a tantrum at Squidward and asks him where the mattress was. Krabs then goes into a "Cash Coma," and ends up in the hospital, where the doctor explains that only the return of his money can save his life. Squidward insists that it was SpongeBob's fault, but a police officer shows him the card, which states that he is solely responsible. The cop says that if Krabs dies, Squidward will be charged for his death and sent to jail. Squidward begins to threaten to murder SpongeBob, but the police officer stops him. Squidward, SpongeBob, and Patrick go to the dump to retrieve the mattress, only to find that there is a vicious guard worm sleeping on top of it.
Meanwhile, the doctor realizes that Mr. Krabs has no insurance and cannot afford his hospital room, and move him into the hallway in front of the vending machines. Squidward tells SpongeBob and Patrick to go inside and get the mattress, but they end up overturning the fence, trapping Squidward inside with the worm. At the hospital, the doctors "surgically remove" Mr. Krabs from the building and leave him on the sidewalk in order to get to the "Nutty Nut Bar," a candy bar in the vending machines he was blocking. Squidward then devises another plan, where SpongeBob and Patrick distract the worm while he retrieves the mattress. The worm becomes obedient to SpongeBob when he sees the wooden spoon he is holding up. SpongeBob unintentionally throws it towards Squidward for the worm to fetch, and Squidward is subsequently attacked by the worm again.
At the hospital, Administrator Flotsam is outraged that Mr. Krabs has been left outside, and they stupidly push him down the hill. Next, Squidward has SpongeBob and Patrick dress as "choice cuts" so that the worm will eat them, telling them that they are in Halloween costumes and that when the worm sees them, he will realize that he forgot about Halloween and left to get candy (which is obviously false and the worm to attack them instead of him). When Squidward expresses his certainty he will be not be hurt this time, Mr. Krabs suddenly rolls into the dump, runs over Squidward, and lands on his old mattress, reviving him. He effortlessly throws the worm aside. Mr. Krabs notices SpongeBob and Patrick and growls at them, but they tell him it is them and Mr. Krabs asks why they are dressed as meat. The worm then lands in Squidward's arms and begins chasing him.
This episode had the most ironic jokes in it; during Mr. Krabs' coma, the doctors repeatedly put him in more difficult situations, each time with the doctors not caring of his well-being. And all of Squidward's schemes that was planned for SpongeBob and Patrick to get hurt, Squidward was hit instead.
Running Gags: Squidward getting attacked by the Guard Worm and Mr. Krabs getting moved around the hospital.
Both Mr. Krabs and Squidward call SpongeBob an idiot in this episode. Mr. Krabs apologizes for it, but Squidward doesn't.
In the Polish dub, the episode's title is called "Afera materacowa" which translates to "The Mattress Wrangle".
When SpongeBob and Patrick are making the card for Mr. Krabs, the Galley Grub sign is in front of the boat. Usually, it is aside from it.
When Squidward was seen bit on the butt by the worm, his neck is gone.
The road that leads to the front door of the Krusty Krab was replaced with sand when the characters are there.
When Mr. Krabs opens the Krusty Krab, there is a keyhole on the door handle. In the next scene, it is gone.
If you look closely when SpongeBob's face moves to the other side of his body, his pants were on the side where his face was before. In the next scene, his pants are on the same side that his face is on.
SpongeBob and Patrick change into meats costumes in outhouses/closets that were not originally there in the scene of the dump.