The early detection and classification of skin cancer are pivotal in improving patient outcomes and reducing healthcare burdens. However, traditional deep learning models in dermatological diagnostics often struggle with the nuanced differentiation of skin lesions. This paper introduces a novel approach, integrating an Advanced Heat Flow Layer into deep learning architectures for skin cancer classification, this method is centered on the principles of anisotropic diffusion, distinguishing itself from conventional image processing techniques by selectively smoothing image areas while preserving critical edge details, essential for accurate lesion identification. In our research, we utilized the Ham10000 dataset, enriched with data augmentation to simulate real-world variability, we conducted a comprehensive comparison of our model, featuring the Advanced Heat Flow Layer, against several benchmark deep learning models, including Sobel Edge Detection Layer. Our model, integrated with various layers of DenseNet121, consistently outperformed these benchmarks across key metrics such as accuracy, precision, recall, F1 score, and AUC, particularly with augmented data, this indicates a significant enhancement in the model's ability to generalize and maintain critical diagnostic features under diverse conditions. Our code is available at, https://github.com/sanadv/SkinCancerClassificationModels/blob/main/Models.ipynb