Nonlinear impairments (NIs) act as limiting factors in the performance of long-haul optical communication grids (OCGs), particularly when operating at 100 Gbps over many channels. These deficiencies become worse by the thermal optics effect, which alter the refractive index of optical components and medium leading to signal degradation . This paper introduces a machine learning (ML)-enhanced technique that uses a convolutional neural network (CNN) to reduce distortions induced by NIs while taking thermal dynamics into account. We expand our investigation to evaluate the quality of service of OCGs under the dual impact of NIs and thermal variations, employing advanced modulation schemes such as polarization division multiplexing 64 quadrature amplitude modulation (PDM-64QAM) and dual-polarization quadrature phase-shift keying (DP-QPSK). Extensive simulations, using a split-step Fourier (SSF) method, are performed to model the combined effects of NIs and thermal dynamics on optical signals. Our methodology is supported by stochastic analysis, which simulates the network’s performance while focusing on activation functions that account for thermal impacts on NIs. Our results show that the CNN-based method, in conjunction with advanced modulation schemes, significantly reduces bit error rate (BER) and improves signal-to-noise ratio (SNR), outperforming traditional methods such as support vector machines (SVM) and digital backpropagation (DBP). The proposed approach demonstrates the potential to enhance the quality of transmission (QoT) in OCGs, making it a viable solution for future high-capacity, thermally influenced optical networks.