As part of an investigation into student learning of thermodynamics, we have probed the reasoning of students enrolled in introductory and advanced courses in both physics and chemistry. A particular focus of this work has been put on the learning difficulties encountered by physics, chemistry, and engineering students enrolled in an upper-level thermal physics course that included many topics also covered in physical chemistry courses. We have explored the evolution of students' understanding as they progressed from the introductory course through more advanced courses. Through this investigation we have gained insights into students' learning difficulties in thermodynamics at various levels. Our experience in addressing these learning difficulties may provide insights into analogous pedagogical issues in upper-level courses in both engineering and chemistry which focus on the theory and applications of thermodynamics.