Microscopic calculation of thermally induced spin-transfer torques