Throw Mama from the Train
(1987)

Larry (Billy Crystal) teaches creative writing in night school, and is very vocal about how he hates his ex-wife. Owen (Danny DeVito) is a student in the class who writes awful mysteries, and hates his overbearing abusive mother.  

Larry tells Owen that to learn how to craft mysteries he should watch old Hitchcock movies. Owen watches Strangers on a Train, a Hitchcock movie in which two strangers commit murders for each other.  Owen then misinterprets Larry's comments to think that Larry is proposing a deal like that.

Owen trails the ex-wife onto a cruise, and pushes her overboard. He then starts pressuring Larry to kill his mother.  Meanwhile, Larry is the prime suspect in his ex-wife's disappearance and has to hide from the police.   The ex-wife turns up alive, rescued by a fishing boat.  She thinks she fell accidentally, so Larry is off the hook.  Larry's novel gets published.  Owen's mother dies of natural causes.  Owen writes a hit children's book.

The movie ends with Larry and Owen on the beach in Hawaii, living it up from the profits of their books.   

Thanks Joseph C!