No, "which" refers to the preceding sentence. The structure assigned by McCawley in TSPE would be:
[S [S I ate the ice cream,] [S which took only 5 minutes] ]
where "which" and "I ate the ice cream" are coreferential. It's an interesting construction, because ordinarily sentences are not thought of as having reference, but here, apparently the clause refers to an event. The appositive relative clause, if "which" were replaced by its antecedent, would come out:
[S [NP [S I ate the ice cream] ] took only 5 minutes ]
which is not grammatical until the sentential subject is nominalized:
My eating the ice cream took only 5 minutes.