Primary Consideration
Due to the controversial nature that this specific problem represents, it takes a mature player and a mature DM to handle this specific scenario well. Ensure that the player and DM have a conversation about something of the magnitude of power revocation BEFORE it is implemented in play...
If you are the DM and this is established as part of your world, ensure that players know this up front if they are considering playing a warlock (or any other class likely to have powers revoked for any reason).
If you are a player and you want this to either be highly probable, talk with your DM. It can create an intriguing story.
Already covered
RAW, there isn't any explicit text that covers a warlock's powers being stripped. Also, there is no class that has rules text covering a loss of powers, save the Paladin whose powers change form when he becomes an Oathbreaker. (DMG p. 97)
Lore from stories associated with various pact-style magic demonstrates and sets precedent that it could be a good story hook, allowing for a very interesting story line that leads to all the things that were mentioned in the original question.
Also Consider
The power belongs to the entity to dole out. If they granted it, it is likely true that they could take it away. This is more of a reference to old literature, to what makes sense, and to what would be fun with the game you and your DM seem to be trying to build.
The rules do not state the specific pact, this is the part that cannot be stressed enough. The power that they currently have should mostly be considered as payment for services rendered. If they are not completely paid for (ongoing payment, for example), then try to avoid stripping a lot of their power from them. Make it minimal, but noticeable. Lower spell slot levels by one levels as that part hasn't been paid in full, if that helps the story line, but do not completely cripple the character.
As for the specific scenario posted in the question:
The devil is highly unlikely to strip power from someone if it is part of a contract. To do so is highly unorthodox for a devil, and would be looked at even more poorly than an upstart servant that the devil couldn't control. The devils live by their contracts, and although adding loop-holes may be favored, rescinding an agreement is not. If a devil were to rescind the power of one of their warlocks, it is likely that another entity would try to mock them by taking the contract instead. This is even more true of a relatively powerful warlock. That said, a devil is also very likely to add a hidden clause that prevents the warlock from using their powers against the devil, with revocation of powers being either temporary or permanent, depending on the devil, the warlock, and the devil's disposition at the time.
They will follow the letter of the contract completely, but don't care about the spirit of the contract. If the devil is powerful enough to grant powers as a patron, they are likely intelligent enough to be more careful about the contract, though a particularly savvy and/or intelligent character could manipulate them in to a contract that is written to the benefit of the character more than the patron (protecting themselves from abandoning the patron, for example).
If you really want to do it
The best way to add the possibility of power revocation for story-line purposes is to ensure that it is an active part of the party's story (as opposed to a passive one). Allow the party to try to stop the powers from getting revoked, or have another patron (possibly a more sinister one) inform the warlock that they are going to lose their powers and offer to be a surrogate patron.
Do something that directly involves the warlock in whether they lose or retain their powers.
In short
Is it possible? Rules don't state that it is, but this is something a DM could easily say yes to with good justification to back it up based on game world.
Should the DM take this path? Probably not, or at least not seriously. If he does, then he should offer a work-around. Don't strip power from a character/player without offering a way of obtaining it again. Don't make the game less fun.
Well then, let's go through the editions. In all versions of D&D, the holy sword is a magic weapon (with high "plus" value) that grants extra powers to a Paladin:
- 0E Greyhawk: Holy Sword: negate spells 1" radius (30' outdoors, 10' otherwise. Yes, effects changed size based on surroundings).
- 1E & 2E DMG: Sword, Holy Avenger: magic resistance 50% (level-dependent) 5' radius, Dispel Magic as spell 5' radius, +10 damage vs chaotic evil.
- 3E DMG & SRD: Holy (weapon property): good-aligned damage, +2d6 vs evil.
- 3E DMG & SRD: Weapon, Holy Avenger: Holy & Cold Iron properties, spell resistance 5+level to self & adjacent creatures, may cast Greater Dispel Magic 1/round.
- 4E DMG: Weapon, Holy Avenger: level 25+ (+5 or +6), +1d6 per plus on critical hit, +1d10 to radiant attacks, 1/day +5 to allies' non-AC defenses in 50' UEoYNT, counts as holy symbol (implement) with same plus.
- 5E DMG: Holy Avenger (sword): +2d10 vs fiends & undead, advantage on saves vs magic 10' aura (30' for level 17+ Paladin).
Before Faerun existed, a Paladin's holy weapon was nigh-invulnerable against spellcasters. In the early Realms it became weaker, but arguably still the greatest non-artifact weapon. After the Time of Troubles, magical properties (including Holiness) became modular and commoditized. Then the Spellplague turned everything fiddly but precise, balanced and rectangular (perhaps the Modrons were behind it). Since the Second Sundering, most items show homage to their pre-Spellplague instantiations. Interestingly, the Holy Avenger even resembles its original form from the old world, albeit much more bounded.
Best Answer
1974, 1990, or 2004, depending
In each of these years, a new option was introduced to D&D that was labeled “warlock.” It wasn’t until 2004 that the warlock was its own class, but 1990 had warlock as a wizard kit (similar to 5e’s subclasses), and 1974—that is, the original books for D&D—had warlock as a title held by magic-users of a particular level.
1974—Original D&D, first use of “warlock” for anything
Men & Magic, the original 1974 “player’s handbook” for the original version of Dungeons & Dragons, included “level titles.” That is, your title changed depending on what level you were in a class, so as a magic-user leveled up, rather than being a 1st-level magic-user, 2nd-level magic-user, and so on, they were a “medium” at 1st level, a “seer” at 2nd level, and so on, until finally at 11th level they became a “wizard” (after that the number would be used, so “12th-level wizard,” “13th-level wizard,” etc.).
Under this sytem, “warlock” was the 8th-level title for the magic-user class. So a “warlock” was just someone who had the magic-user class, and also was 8th level.
Basic and advanced D&D also used this system, and the warlock title.
1990—Advanced D&D 2e, first use of “warlock” for a unique character choice
1990’s Complete Wizard’s Handbook introduced “witch” as a “kit” (somewhat similar to 5e’s subclasses) for the wizard class, and indicated that rare male witches “are also possible, commonly called Warlocks.” Witches get their magic from extraplanar sources (e.g. fiends), and according to the book, usually prefer “enchantment/charm” though “Conjuration/summoning and necromancy are also good choices.”
2004—D&D 3.5e, first time “warlock” is a fully-independent class
2004’s Complete Arcane for D&D 3.5e was the first time that warlock was presented as its own separate D&D class. It established many of the tropes still associated with the D&D warlock today:
Pacts—every warlock got their power from a pact forged with a powerful (but non-deific) being, but the warlock themselves didn’t necessarily need to be the one who agreed to the pact. In 3.5e, these pacts could “taint” entire bloodlines, making it possible to become a warlock because of something one’s ancestor agreed to.
Numerous places within the text refer to pacts as being made with fiendish or fey beings (which is reflected in the requirement that warlocks be Chaotic and/or Evil), but the nature of the pact doesn’t actually change anything for a 3.5e warlock (they still get “fiendish resilience” etc. even if their pact is fey in origin—the authors seemed to forget non-fiendish warlocks were possible).
Eldritch blast—every warlock was able to use eldritch blast by default, which fired a ray of arcane energy at a target, dealing damage.
Invocations—the primary magic of the warlock class was invocations, which in 3.5e meant at-will spells.
2008—D&D 4e
The 4th-edition Player’s Handbook presented the warlock for that edition, which was similar to the Complete Arcane version but subtly different in significant ways:
Pacts—now warlock pacts have mechanical significance, with different pacts signifying the different powerful beings capable of making warlocks. Moreover, each warlock must personally make a pact with something—no more “inheriting” the pact any more.
Spells—prior to the Essentials line, every class in 4e used the “AEDU” system, referring to At-will, Encounter, Daily, and Utility powers that were gained at fixed intervals that were the same for every class. Because warlock was an arcane class, these powers were known as spells—even the at-will and per-encounter ones. As such, “invocation” wasn’t really a term in 4e, nor was the warlock’s use of arcane magic as fundamentally different from other classes as it was in 3.5e.
2014—D&D 5e
And once again, with a new edition, we have a new warlock, again right there in Player’s Handbook. The 5e warlock again changed a few things up:
Pacts and patrons—in 5e, warlocks can make independent choices about the type of pact they make as well as which patron they make it with. So not only can the warlock choose to have a fiend or a fey as their patron, they can also choose to make a pact of the tome or pact of the chain with either of them (and more besides). Each choice has mechanical implications and differentiation.
Invocations and spells—in 5e, warlocks are back to having “invocations” as a unique thing that warlocks do, and these are again often at-will magic abilities as they were in 3.5e (though not always).
Warlocks also have spells, which are refreshed after a short rest instead of a long one—making them similar to 4e’s Encounter powers. And since the AEDU system is gone, and all other spells are, in 4e’s terminology, “Dailies,” warlocks once again have a unique niche of being able to use spells more frequently, somewhat reflecting their 3.5e roots.