Although as someone mentioned upthread, it could be Lilly that's dying, that would warrant a similar reaction from Ted. At this point it seems too obvious that it could be the Mother thats dying, which could be a big head fake to the character that we've known for so long.
I originally didn't think Lily could be the character Ted is sad about, however with the additional information we've been given last week about Lily now having a daughter, that does add credence to the suggestion.
I wonder if that was their intention? To delay the information about Lily being pregnant until after we've been hit with the "some female will die in the future" possibility?
I don't think the Mother will be dead, because I don't think they would do that to Ted... it would really kill the replay value of the show. Lily on the other hand, while she's beloved, she's not the Mother.
*Note: I have not and will not click the spoiler link above. At least not until the finale has aired.