In recent years Cyber-Physical Systems (CPS) and Industrial Internet of Things (IIoT) have gained significant attraction; however, it remains a vulnerable target for cyberattacks. Machine learning techniques have garnered interest in security applications due to their rapid processing capabilities and realtime predictions. However, imbalanced data distribution is a prevalent issue in IIoT environments, adversely affecting MLbased attack detection systems. In this work, we present a novel gametic heredity-based oversampling technique for addressing imbalanced data challenges in cybersecurity applications, specifically targeting IIoT systems. The proposed model enhances diversity in the minority classes by generating unique synthetic minority samples, creating diverse synthetic data while restricting instances to the minority class region. The proposed model outperforms complex and conventional methods in terms of precision, recall & F-Score while mitigating over-generalization by evenly distributing newly generated samples within minority class boundaries and regions. To validate the proposed model and verify its efficacy in identifying cyber threats, we used the UNSW-NB15 dataset. Simulation results demonstrate that the proposed model efficiently detects attacks with high performance compared to state-of-the-art techniques. Our research contributes to developing robust & efficient machine learning models for enhancing the security of IIoT systems while handling class imbalance issues.