The baddies in this episode were the Whispermen, who kidnap the Doctor's friends Clara, Vastra, Jenny and Strax to lure him to the one place he must never go: his grave, on the planet Trenzalore.
There is no body in the Doctor's tomb. Instead there is a time tunnel, made of scar tissue from all the Doctor's travels through time and space. The villain of the piece, the Great Intelligence (hammed up wonderfully by Richard E. Grant) enters the time tunnel, aiming to split itself into fragments scattered throughout the Doctor's timeline and corrupt it absolutely, undoing all the good he's done.
Clara follows it into the time tunnel in an attempt to reverse the damage. Things take place around her. Previous incarnations of the Doctor run by. At first she feels out of control. She has no idea what's going on.
We're the impossible girls and boys. We learn our purpose. We regain control over our lives.