The Cosmic Puppets

The Cosmic Puppets (original title: A Glass of Darkness) is a science fiction novel by American author Philip K. Dick, published in 1957. It is a novelization of a short story initially published in the December 1956 issue of Satellite Science Fiction.
The Cosmic Puppets was first published as a novel by Ace Books as one half of Ace Double D-249, bound dos-à-dos with Sargasso of Space by Andrew North (better known as Andre Norton).
Ted Barton, having left Millgate, Virginia several years ago, returns with his wife Peg to find his hometown strangely transformed. Street names and landmarks do not exist as he remembers them, and the inhabitants of the town are similarly oblivious to their contradictory past. Peg proves intolerant of her husband's interest and abandons him while he explores the town.
While in Millgate, Barton meets three sympathetic locals: Doctor Meade, a family physician; his daughter, Mary; and William Christopher, a town drunk. However, Mary has a menacing counterpart—Peter Trilling, the deceptively young offspring of the town's hotel owner. After Barton's departure from Millgate is blocked by a permanently jackknifed logging truck obstructing the only route out of town, he discovers that Christopher remembers the town's erased past.
Christopher recalls an event entitled "the Change", which occurred eighteen years beforehand, after Barton had left Millgate. In his previous life he was an electrician but is now working to revert Millgate to its previous state of existence. Dr. Meade and Mary have the same agenda, as Meade's "Shady House" patients turn out to be "Wanderers", incorporeal former inhabitants of the erased Millgate who can communicate with Mary and certain others. Barton is able to revert objects, as well as an erased park, at which point Mary discloses that she is also aware of the Change and the prior Millgate.
Mary and Peter are in fact engaged in a low-intensity supernatural proxy war against one another. She can only use bees, moths, cats and flies against his control over golems, spiders, snakes and rats, and initially seems to kill Mary through his servitors. However, even this traumatic event is not enough to cause Dr. Meade to abandon the comforting illusion of his false human identity. Two vast, supernatural entities loom over Millgate, however, and Barton realises that Meade is one of them, as Peter Trilling reverts to his own, malignant divine self. He uses his servitors to attack Barton, Christopher and the Wanderers, but is stopped as Meade remembers his past, and reassumes his own divine identity.
At the denouement, Millgate finds itself in the crossfire of a battle between the twin but diametrically opposed demigods, Ahriman (the "destructive spirit") and Ormazd (the "creator") of Zurvanism. Ormazd eventually triumphs, and Mary reveals her own true identity as Ormazd's messianic daughter, Armaiti, who arranged for Barton's exile and return to the town when it was time to overthrow Ahriman's false illusion. The former Millgate returns to solidity, Christopher resumes his career as an electrician forgetting the Change ever occurred, and Barton leaves the town, having restored the "true" nature of the community to what it was.