The Ex-File of the title is Gibbs being confronted with an ex-wife (Stephanie, whom he married in Moscow and lived with for 14 months), an ex-lover (Director Shephard) and a "future ex-wife" (as everyone on his team thinks of Hollis Mann).
A marine's wife discovers her husband dead in their house when she returns from a convention, apparently murdered with a speargun's shaft through his chest. Since the Marine and his wife live on an Army base, the location of the crime thus draws the attention of Gibbs' current girlfriend, Hollis Mann, who takes over the investigation with the NCIS team. This calls the DIA in action, for whom the dead marine worked. They insist that his laptop is given back because it contains highly classified information, but Director Shepard refuses and offers to let them send an agent over to oversee Abby's work with it which they accept with Fred Rinnert.
Abby is not pleased with the new guy looking over her shoulder but he manages to befriend her. Together they find out that the dead marine uploaded a copy of Tom Lehrer's "The Elements" to a file sharing network shortly before he died. Gibbs in the meantime confronts Major Eric Sweigart, the dead marine's boss, asking if he killed him but he claims to have an alibi, backed by Stephanie Flynn, who turns out to be Gibbs' third ex-wife. They bring her in for questioning and she fears that Gibbs wants to ruin her relationship with Maj. Sweigart. But they cannot find any reason to doubt her, so they let her go and concentrate on Jill Reynolds, the widow, who benefits from huge life insurance pay-outs and is busy cleaning the house. They conjecture that she could have driven home from the convention, killed her husband, gone back and then returned home with a witness to "discover" the murder. They bring her in for questioning but it turns out that she did not leave the convention after all, proven through CCTV footage of her there at the time of death.
The team focuses on Stephanie again, who raises suspicions by not answering her phone and quitting her job. But Abby manages to find a hidden file on the laptop, which filters the music so that only certain elements from "The Elements Song" are highlighted: the periodic numbers of those elements provide the main clue. McGee, in the nick of time, works out that the numbers correspond with an offshore bank account. Fred Rinnert, the cyber guy sent to oversee Abby's work with the secret DIA laptop, sent Abby on a wild goose chase to see Gibbs. When she returns to the lab, the hard disk was erased and it turns out that Fred Rinnert, the overseer helper, was actually the villain who tried to hide his tracks after killing Reynolds because he wanted all the money they made together by selling government secrets. McGee is delighted that Rinnert is shown to be false, as McGee had been jealous of the attention Abby lavished on Rinnert. Abby's response to Rinnert's betrayal is to seek permission to punch Rinnert. Gibbs denies her the pleasure until they have secured all the proof needed to convict him: she is then allowed to throw a punch. Successfully.
The key theme for this episode is music and the key character development emerges from Gibbs having to confront his past relationships, face-to-face with three of his lovers, past and present and future, at once. The music theme is established at the beginning with Abby buying each team member an iPod music player (using her tax return money). This allows us to learn that Gibbs only listens to 5 songs (and thus does not need a machine that holds 40,000): he is not into music. As the episode progresses, the main clue in the case is Lehrer's Elements Song: dealing with that song is the key to solving the crime.
And, in the final scene, music provides the revelation as to how badly Gibbs still mourns his dead wife and daughter. Having returned from a happy evening out together, Gibbs and Mann descend to his basement to work on the boat. He has to run an errand upstairs, so Mann starts to assemble the sanding tools. She finds a cassette player and, thinking Gibbs has been uncharacteristically romantic in providing music for their evening's labour, presses "play". The music is unexpected: naive, classical piano. Then a child's voice full of glee tells Daddy that she took second place in the piano competition and that she will play it better by the time he comes home from the war. His first wife's voice is heard too, with expressions of love and longing for his return. The music theme was the classical basis of "Hush little baby, don't say a word, Daddy's gonna buy you a mocking bird". Gibbs, having returned whilst the tape was playing, has sat down on the stairs to the basement: Mann is watching the cassette player, moved to tears. The tape ends. The episode closes with them looking across the room at each other. All lightheartedness is gone, no words are said.
On its original airdate, the episode attracted approximately 16.1 million viewers in total with 3.4% rating and 10% share for the 18 to 49 years old demographics, allowing NCIS to win its 8:00 pm timeslot.