An electrocardiogram (ECG) serves as an essential tool in the medical evaluation of cardiac diseases. An ECG signal over a period may be utilized to detect a myocardial infarction (MI). This study is based on the development of an optimized deep convolutional neural network (deep CNN) with a long short-term memory (LSTM) framework for multilabel classification with the help of a single-lead ECG signal. The Chebyshev filter is used in the initial stage of the framework to remove the noise present in the ECG signal. The filtered signal is windowed and converted into images using optimum time-frequency domain conversion techniques. The images are given input to the optimized deep CNN with the LSTM framework to acquire the spatial and temporal attributes for the MI classification. The optimized deep CNN with LSTM is obtained by optimizing the important hyperparameters of CNN to provide a lesser fitness value using the Grey Wolf Optimization approach. The proposed optimized deep CNN with LSTM framework is compared with pre-trained models (AlexNet, SqueezeNet, GoogleNet, ResNet18, and MobileNetV2), deep CNN, deep CNN with gated recurrent unit, and existing techniques. The proposed optimized deep CNN with LSTM framework produced an overall classification accuracy of 99.21%, sensitivity of 99.28%, specificity of 99.13%, precision of 98.30%, recall of 99.28%, an F1 score of 98.74%, and a G-mean of 99.22% for 10-fold cross-validation, and it outperforms some of the existing methods.