Eleventh Doctor (Ganger)
The Doctor was a Ganger cloned from the Time Lord of the same name. When a bolt of solar energy struck the vat the Flesh was contained in, it was able to form a copy of the Doctor from a measure of his genetic material, gained when he touched the Flesh.
This Ganger was created by the Flesh without instruction from the human workforce; seemingly by the consiousness that the Doctor was able to sense in the substance. Without human instruction, it took the Flesh longer to generate the Doctor Ganger than it did a human Ganger.
When the humans and the Doctor fled from the other Gangers into the church, this Ganger confronted them and told them to trust him. (DW: The Rebel Flesh)
The duplicate 11th Doctor may return in the future, as a line towards the end of the episode suggested that there 'could be a way back' for both the Ganger Doctor, and Cleaves, even after they had both apparently been killed.
This may or may not leave the door open for Matt Smith to return in the future even after he decides to leave, somewhat mimicking the door left open for David Tennant back in 2008 when a clone version of the 10th Doctor was left with Rose in the parallel universe.