I've started a thread on this subject as well...Doc doesn't appear to remember the events of Episodes 1 and 2, and wonders why Marty's in 1931, but in the end, he claims that he travelled back to 1931 to find out about Marty's grandmother to write the family tree...
It seems that we essentially have Docs from 3 different timelines roaming around at different points in 1931...
The first Doc to arrive in 1931 is the Lone Pine/Eastwood timeline Doc we've been following in the movies...this Doc, after BTTF3, either lived in the Old West, or was travelling through time all the time (pun intended)...at some point, he picks up the duplicated Delorean in 2025, and travels back to 1931, to research Marty's family tree, assuming the identity of Carl Sagan. He ends up being arrested and accused of being the speakeasy arsonist. He's the Doc we follow in Episodes 1 and 2...and he eventually gets erased from existence owing to the younger Emmett Brown falling in love with Edna, drastically changing the future...as soon as he returns to 1986.
The second Doc to arrive in 1931 is the Doc from the First Citizen Brown timeline...he's the Doc we follow in Episodes 3, 4 and the early part of 5; he never invented a time machine, was married to Edna and nearly brainwashed by her, but repaired the time machine of his counterpart (the first Doc) and travelled back in time with Marty, assuming the Carl Sagan identity of the previous Doc. He tries to sabotage Emmett's experiment but failed. The younger Edna double-crosses him and steals his Delorean (actually the Delorean of the erased first Doc). Owing to Edna's influence being removed from the younger Emmett's life, his timeline is now completely erased, and thus, he himself is erased from existence (though he was seriously injured anyway from being run over).
The third Doc to arrive in 1931 is the Doc we follow through the latter half of Episode 5, and his history is a little less clear. He remembers meeting Marty back in 1931, and is given a newspaper article about the future by Marty, which he keeps with him till 1986...apparently, after the events of BTTF3, he lives in 1986 Hill Valley, and owing to his far better relationship with his father, he runs a foundation in the latter's name. This Doc apparently travels back to 1931 simply because he remembers Marty being there. He is also in possession of a Delorean, albeit one that is completely distinct from the Delorean used by Lone Pine/Eastwood Doc and FCB Doc...the origins of his Delorean are unclear. Yet, in the end, he claims he did travel to 1931 to research Marty's family tree, which is something the Lone Pine/Eastwood Doc did...he apparently, doesn't remember being jailed or accused of being the speakeasy arsonist.