During a routine medical examination of several members of Voyager's crew, The Doctor discovers evidence that Ensign Harry Kim has, at some point within the previous two years, undergone surgery of a complex and specific nature, which could only have been performed by the Doctor himself.
Having no memory of the procedure, The Doctor attempts to reconstruct evidence surrounding the time period, but finds that some of the files in his extensive photographic collection of the crew have been deleted. A reconstruction and search of the files reveals pictures of a crewmember of whom he has no recollection - Ensign Jetal.
Despite several anonymous attempts to delete the results of his investigations from his recent memory, The Doctor eventually discovers a conspiracy by the crew to keep him from remembering events that led to the holographic equivalent of a psychotic break. The trouble started when a shuttlecraft was attacked, causing several casualties. The Doctor was faced with making a choice between two critically-injured patients - Ensign Jetal and Ensign Kim - with an equal chance of survival, but a limited amount of time in which the Doctor could act, meaning that he had to choose which of the two to save. The Doctor happened to choose Ensign Harry Kim; Jetal died on the operating table. As time passed, the Doctor was overpowered by guilt, believing that his friendship with Harry somehow influenced his choice. The Doctor fears that he may have, however inadvertently, let Ensign Jetal die so that his friend could live. These events created a conflict between those parts of his program that compelled him to act impartially, and those that comprised his ethical sensibility.
On having the previously-deleted files of these events reinstalled into his memory, the Doctor's mental stability begins to deteriorate as before, and Captain Janeway is faced with deleting his memories of events once again, or attempting to allow the Doctor to come to terms with his guilt, although this would possibly endanger the crew by effectively leaving them without an experienced medic in the interim.
Having been convinced by Seven of Nine that the Doctor has reached a point in his personal development where he deserves the chance to evolve beyond the constraints of his program - and by extension, his very nature as a piece of technology - Janeway allows him to retain his memories and eventually come to terms with what he's done.