There's only one way where Thane survives the attack:
If Captain Kirrahe survived Mass Effect's final mission, you'll meet him during the mission to recover the female Krogan. If you didn't talk to Thane prior to the attack on the Citadel, Kirrahe will intervene instead of Thane and die in his place.
However, I wouldn't mourn Thane's death. If you speak to Thane prior to the attack, you'll learn that he's near the end of his life regardless of what happens. He says that one doctor gave him 3 months to live 9 months ago. He also talks about his constant pain and feelings of suffocation. For him, this is likely an honorable and worthy end.