A Connecticut Yankee in King Arthur's Court
This book is namechecked by Reg in episode six, being about chivalry, civilsation and a man out of time.
In the book, the Yankee is knocked unconcious with a crowbar and wakes up in the 6th Century surrounded by knights, Camelot, the whole deal. Like Sam, he first believes that he has gone mad, and is in an asylum. Everything seems real, but he can't quite believe it, not until he tests reality with his knowledge of an eclipse.
"Though his "consciousness knows" that he is in the year 528, his reason, something of which the Yankee is very proud, refuses to accept it without scientific evidence."
Stuck in the past, the Yankee begins to re-create his world, introducing 19thC technology, customs and beliefs to the people of olde England, much like Sam does, introducing his gay boy science to the 70s coppers.
"Hank's full intent is to subvert the current order and institute the type of civilization he deems best, one that closely resembles nineteenth century America."
Or in Sam's case, 21st Century England, where he considers the rules and regulations he has to live by superior and more civilising than the brutal, wild west town he has found himself in.
In the book, things start taking on a dark turn as enlightment becomes a poisoned chalice. Hank's industrial revolution goes tits up, causing massive death and destruction and social disorder. This could possibly be the darker things TOPTB keep hinting at, but it is worth noting that it is Sam himself who keeps introducing the technology, rules and ideas that he himself felt so strangled by in 2006. He is, in effect, sowing the seeds of his own destruction.
References:
http://etext.virginia.edu/railton/yankee/cyhompg.html
A Connecticut Yankee in King Arthur's Court
http://www.geocities.com/swaisman/yankee.htm
A Connecticut Yankee In King Arthur's Court
http://www.gutenberg.org/etext/86
A Connecticut Yankee in King Arthur's Court by Mark Twain
http://en.wikipedia.org/wiki/A_Connecticut_Yankee_in_King_Arthur's_Court
A Connecticut Yankee in King Arthur's Court
http://www.sparknotes.com/lit/yankee/summary.html
Overall Analysis
http://etext.virginia.edu/toc/modeng/public/TwaYank.html
A Connecticut Yankee in King Arthur's Court
http://www.gradesaver.com/classicnotes/titles/connecticut/
ClassicNote on Connecticut Yankee in King Arthur's Court
Alice in Wonderland
This book was not only name checked but waved around in episode eight. It's also been discussed elsewhere, and with much better insight, but I'll mention it just to try and start a discussion.
Alice's adventures share a similarity with Sam's down the rabbit hole as they both share a sense of unreality, they question the very nature of reality, things are all topsy turvy and they meet characters they find impossible and illogical, although this is a rather simplistic view, most of the folks in LOM hve a far greater depth and purpose than, say, the Mad Hatter, who is simply stuck in Tuesday, rather than 1973.
Alice can also be read as being about a child growing up, perhaps young Sam, or the growing up Sam still has to do, especially as he's been repressing events in his childhood. Is Sam, however, truly helpless to the whims of the world about him, and rules he doesn't understand, or is he more of a fighter than that?
References:
http://www.alice-in-wonderland.net/?explain/alice841.html
An analysis of Alice's Adventures in Wonderland
http://www.alice-in-wonderland.net/?explain/alice826.html
Secrecy and Autonomy in Lewis Carroll