While chasing after a fugitive on the roof of a San Francisco building, detective John “Scottie” Ferguson slips and falls, but before plummeting to his death he is able to grasp onto the gutter on the side of the roof. As John is hanging on for dear life, one of his colleagues leans over the edge in an attempt to save him, but ends up falling to his death. The sight of the man descending down into the alleyway traumatizes John, and eventually leads to a diagnosed case of acrophobia.
Due to his crippling fear of heights, John is forced to quit the police force. One day he receives a call from his old college friend, Gavin Elster, who is aware of John’s condition but is still willing to offer him a job. Elster tells John that he wants to hire him as a private eye, following and monitoring the behavior of his wife Madeleine. Elster goes on to explain that he does not suspect infidelity. He believes that a spirit of some kind has possessed Madeleine, and is causing her to act differently and fears that she may be suicidal. John is skeptical, but he decides to accept Elster’s job offer anyway.
John begins to follow the stunningly beautiful Madeleine as she wanders around town. First she visits a flower shop, where she buys a bouquet. Then, she wanders into a cemetery where she stands and stares at a tombstone. After Madeleine leaves the grave sight, John notes that the headstone reads, “Carlotta Valdes born: Decmber 3 1834 died: March 5 1857”. He then follows Madeleine into an art museum where she sits and stares at a portrait of a woman. John notices that Madeleine is sporting the same exact hairstyle as the woman in the painting, and that the bouquet of flowers that she previously bought at the flower shop is identical to those that the woman in the portrait is holding. He asks one of the museum employees what the name of the painting is. The man tells him that it is titled, “A Portrait of Carlotta”. John later finds out, from Elster, that Carlotta Valdes is Madeleine’s great grandmother.
The next day John follows Madeleine to the San Francisco Bay, where she jumps into the icy cold water. John dives into the bay after her and, after dragging her unconscious body out of the water, brings Madeleine back to his home. After she regains consciousness, she tells John that she doesn’t remember much, but recalls fainting and falling into the bay. The phone suddenly rings and John races into the other room. It is Elster. He tells John that Carlotta Valdes was twenty-six years old when she committed suicide, the same age as Madeleine. When John returns back to the living room, Madeleine is gone.
The next morning, John trails Madeleine back to his own house. She was leaving a thank you note in his mailbox. John approaches her, and persuades her that wandering together would benefit both of them. They return back to the spot where Madeleine had jumped into the bay, and John urges her to try and remember what happened. Her memory is distorted, but she recalls an empty grave without a name on it, a tower, and a bell. At this point, both of them have fallen for each other. They share a kiss as the waves splash against the rocks, and John promises to protect her.
Madeleine returns to John’s house the next day shaken up about a horrible nightmare she had the night before. She once again describes a tower, a bell, and a village in her dream. John realizes she is dreaming of an actual place, and decides to drive her there in order to confront her inner demons. Once they arrive John points out all of the landmarks that were in her nightmare. They kiss each other, and Madeleine says to John, “…if you lose me, then you'll know I loved you. And I wanted to go on loving you''. She then starts running towards the bell tower, and John chases after her fearing that she may hurt herself. Madeleine runs up the spiral staircase to the top of the tower. John, on the other hand, is unable to make it to the top of the tower due to…