Sailing the 7 Zzz's is episode 1b of season 4 of Rocko's Modern Life.
While attending a play on pirates at the O-Town Opera, Ed Bighead begins to reminisce on a traumatizing and humiliating childhood experience in which at the age of six, he played a similar role in a school play but was quickly overcome with stage fright and unable to say a single line, eventually breaking down and crying. The memory causes Ed to cry outloud in the same fashion, disrupting the entire performance and embarrassing himself and his wife in front of the whole audience.
Back home, while questioning Ed on his sudden outburst, Bev Bighead tries to assure him that this childhood experience is nothing to be ashamed of, but Ed angrily cites that it made him the laughing stock of Stinkpond Elementary and blames it on the existence of the treasure map that he did not have possession of during the performance. Beverly offers a foot massage to make him forget about it, but goes to sleep in a total huff after Ed bitterly rejects the offer.
Late into the night, the memories resurface in Ed's slumbering mind, causing him to start sleepwalking and assuming the role of a stereotypical pirate quite accurately, dubbing himself "Captain Blackhead", and rambling loudly on the roof about the treasure map that belongs to him, waking up his next door neighbor Rocko from his sleep. Rocko tries to drown it out by closing his window and folding his mattress over him, but to no avail, especially with his dog, Spunky chewing on his squeaky monkey toy all the while.
The next morning, both Ed and a very sleep-deprived Rocko walk to their cars simultaneously as they leave for work, where Rocko greets him with the words "Ahoy there, matey". Ed, having no recollection of anything that went on during his sleepwalking, merely calls Rocko a weirdo before they both depart for work.
The following night, Ed begins sleepwalking at the exact same time as last night and resumes his ramblings about the treasure map he seeks, waking up Rocko yet again, this time provoking Rocko to tell him to be quiet. Ed, in his sleepwalking state, sees Rocko as the pirate who is responsible for his stolen treasure map and "swims" over to his "ship". Smashing through the window of his bedroom, Ed demands the treasure map, leaving Rocko dumbstruck about his neighbor's unusual behavior. Trying to pry the whereabouts of his map out of Rocko, Ed takes him to the roof and tries to walk him over a plank and into the "ocean", until he returns to a near sleeping state where he mumbles unintelligibly and begins walking away, causing Rocko to realize what is really wrong with his neighbor, shortly before Ed steps off of the plank, causing Rocko to fall into his front lawn.
With Ed's sleepwalking behavior depriving him of a good night's sleep, Rocko takes new precautions to insure Ed does not invade his home again by nailing his front door shut (even though Ed never used it to invade his house to begin with), only for it to be slammed open by Heffer and Filburt, who have come over with videocassette copies of some movies that they want to watch with Rocko. Rocko, having been mashed into the wall by the sudden opening of his front door, painfully postpones their movie night for another time and tells them about Ed Bighead's pirate behavior that is keeping him up at night. While Heffer and Filburt find this hilarious, Rocko finally snaps and tells them that if Ed wakes him up once more, he will go crazy. Heffer, in a rare display of rational thinking, suggests that Rocko simply make a treasure map to give to Ed the next time he comes for it.
After some initial pointless childsplay between Filburt and Heffer, Rocko draws a map and waits for Ed to return for it. Heffer and Filburt ask to stay and watch, but Rocko, knowing his friends' behavior all too well, sends them off so he can be done with this nonsense.
That night, Rocko receives a call from Ed, who has returned to his sleepwalking pirate state of mind, but then suddenly appears in Rocko's house. Ed notices the map in Rocko's hand and demands it, who gives it to him without hesitation and starts escorting him to the front door. Upon opening it, Rocko finds Heffer and Filburt standing there, dressed as pirates and prepare to fight Ed for the map. Rocko tries to inform them that Ed has what he has come for and is now going home, and that no further action against him needs to be taken. Heffer ignores Rocko's plea and, with a ridiculous European accent, sword fights Ed while Filburt swipes the map from Ed. Rocko takes it back, but is then chased up to the roof by Heffer, who has become carried away by this charade.
Once Heffer finally stops, Rocko realizes that Ed has taken Spunky hostage and makes one final demand for the map. Rocko prepares to give it to him, but Heffer takes it from him, not willing to give in to Ed's demands, prompting the latter to use his drying machine as a "cannon" to fire various heavy objects into Rocko's house, eventually causing the house to "sink". With the map out of Heffer's hands after being knocked off his feet, Rocko makes to save his house form any further damage and folds the map into a paper airplane and throws it to Ed. Ed keeps his end of the bargain and returns Spunky to Rocko, unaware that what he believes to be a parrot which could "fly back to it's rightful master" with ease is really a dog, prepares to release Spunky in midair. With the use of a rope (which oddly, is tied to absolutely nothing in the sky), Rocko not only saves Spunky from a deathfall, but also lands in the exact spot where the "treasure" is buried. Pushing his neighbor aside, Ed digs in and proudly finds the treasure to be none other than Spunky's squeaky monkey (something which had been annoying Rocko just as much as Ed's pirate antics).
With the treasure found, Ed finally snaps out of his sleepwalking state and, still with no recollection of anything that happened, wonders why he, Rocko, Spunky, Filburt and Heffer are on his front lawn. Ed, finding he would be better off not knowing, dismisses the entire thing and returns to his house, telling Rocko and his friends to leave the premises before he calls the police, taking the squeaky monkey toy with him.
While Spunky is saddened to have one of his favorite toys taken away from him, Heffer assures him they will get him a new one once they reach the north pole, suddenly switching the entire background to a submarine bridge.
With the ghosts of his humiliating childhood experience finally put to rest, Ed sleeps peacefully while tenderly squeezing the squeaky monkey toy he took from Spunky.
Meanwhile, the "submarine" Rocko, Filburt, Heffer and Spunky comandeer continues to veer towards the north pole, Filburt informs his friends of his nausciousness, which shortly lead to vomiting.