Difference between thoracic and cardiothoracic surgery?

Similar. Cardiothoracic surgery includes surgery on the heart as well as other structures within the chest (thorax). Thoracic surgery might not include surgery on the heart. This is confusing because the name of the organization which is the certifying board for either one is the american board of thoracic surgery, so practitioners that are board certified are certified in "thoracic surgery".
Term usage. Thoracic surgeons operate on the chest and the organs within: heart, lungs, esophagus, chest wall. You may also find a common title of "cardiothoracic surgeon" or in more specialized regions a distinction will be made between heart surgeons and non-heart surgeons, i.e. "cardiovascular surgeons" vs "thoracic surgeons".
Heart Surgery. Cardiothoracic surgeons are trained to perform cardiac ("open heart") and thoracic ("chest", "lung") surgery. Thoracic surgeons are only trained to do the latter.