A Shock to the System is
- a novel by British author Simon Brett first published in 1984; and
- a U.S. film (1990) by Jan Egleson based on Brett's book starring Michael Caine, Swoosie Kurtz, Elizabeth McGovern, and Peter Riegert.
Warning: Wikipedia contains spoilers
An unfortunate accident on the underground caused by Marshall in which a tramp is killed but which goes unnoticed gives him a whole new set of ideas as far as his future life is concerned. Deciding to take revenge on all the people who have caused him problems in his life, Marshall starts meticulously planning their violent deaths. This includes his wife, whom he eventually electrocutes (hence the ambiguous title), and his young rival at the office. He is confirmed in his belief that killing off everyone who has harmed him is the right thing to do when it turns out that none of the murders is linked to his person, and Marshall soon passes the point of no return. At the very end of Brett's novel, however, out of the blue, overwhelming evidence is brought against him for a murder he did not commit.
This ending was first used by Anthony Berkeley writing as Francis Iles in his 1931 novel Malice Aforethought (see whodunnit). It should also be noted that the ending of the movie version is completely different, with Marshall exulting in his new life of crime and no danger whatsoever of his being brought to justice.