So you've had yet another knife in the back from a co-worker, and it's time to pay them back? The gentlemanly response for this is "Turn the other cheek" and "be the better person" but come on! This isn't about how to deal with co-workers from hell. It's how to get revenge! Revenge is not ignoring someone, or rising above their ignorance or villainy. Revenge is the cold dark feeling of satisfaction you get when a person's work life has been impacted to compensate for how badly they have treated you!
First step, wait until the heat of anger wears off. In the moment you find out that your peer has stolen credit for your work, or has spilled their soda on your desk, or has taken a juicy sales lead from your desk, you might feel inclined to punch them in the face. Revenge is a dish best served cold, and when you are hot with emotion, you cannot cook that meal. Taking a moment (or an hour, or a day) to calm down serves multiple purposes. You are able to measure the wrong done you (That spilled soda was really an accident, and the fellow is truly sorry for it) and also will enable you to come up with something truly dastardly if the occasion calls for it.
Next step, measure your revenge. It must be very close or equal to the harm done you. Getting someone fired, or telling his wife about his mistress, is not equal to your co-worker talking too loud constantly on the phone in the cubicle next to you. Upping the ante puts you in the wrong, and that's not revenge, that's just being a jerk. Also this has the potential for a never-ending disastrous sycle of escalating pain. Make sure the punishment fits the crime.
This is also an equitable way to decide what the revenge will be. If your co-worker is a noisy twit, tape-record something awful they say, then play it back later when they can hear it. Note this does not include giving the tape to a boss that has the co-worker saying harsh things, as this will handicap that person's livelihood on a long-term basis. This is more like taping a man making callous jokes about another employee, then sending that recording in an e-mail back to them (preferably anonymously). Most will feel very guilty, and start watching their tongue.
If the individual is a real nasty SOB (stealing your work or leads or some such), more extreme measures are in order. Planting a poorly-written work assignment or a big waste of time lead is an appropriate revenge, but takes some planning and forethought. The benefit here is that if the co-worker believes they got away with it, they will do it again, so patience here will pay off. It even would be prudent to keep this false lure in an easily accessible location. Changing the name at the top takes a few seconds, but will keep it fresh as bait for the office thief.
If your co-worker is a nagging pain, find someone who is equally bothersome in the office, and make sure they meet up. Introduce the hard-core Conservative to the outspoken Liberal. They will either argue like cats and dogs, freeing you up for other things, or else the original pain in the butt will see that you clearly don't agree with them, and move on. If they don't get the hint the first time, make sure that you repeat the exercise, "You know who would be interested in that? Carol in Accounting, she loves talking about Politics!"
Make sure that you cannot be connected directly to your revenge! It is sweet in the moment to have your odious co-worker know that you got them back, but it also leads to a never-ending cycle of payback, and this is not something you want to be involved in. It usually leads to both employees being reprimanded or even fired!
These are just a few examples (some good safe ones), but a good set of guidelines for revenge in the office. Note that any harassment or genuine damage (theft of property, etc.) should be reported to your bosses. This is never best handled alone, as the appropriate revenge is generally a criminal act also! The officials always catch the second foul, as they say in the NBA, so any personal revenge appropriate here can easily get you fired. Be careful and thoughtful, take some time to calm down and plan, and more often than not when you take your revenge, it will be sweet!