Sentence 1 is correct. The second clause has a verb that is conjugated in the past perfect tense. The past prefect tense is used, when two actions took place in the past. The action that happened first is placed in the past prefect. The action that took place second is placed either in the past indicative or in the past imperfect tense / past progressive tense.