Smart grids require high reliability and sufficient bandwidth from wireless networks to support critical real-time applications and massive smart microgrid data. In general, smart microgrids need to guarantee delays at the order of a few μs for highly delay-sensitive data delivery; as well as delays within few seconds for regular data delivery. This paper presents a framework and its performance analysis for microgrid data aggregation where the microgrid is served by a wireless heterogeneous network. Using unsupervised machine learning, the framework introduces a multi-class and delay sensitivity-aware aggregation of microgrid data within the small cells of the heterogeneous network to ensure that clustering reduces the processing time for highly delay-sensitive messages. Thus, at each Transmission Time Interval (TTI), if there is queued delay-sensitive data, they are dequeued ahead of the delay-tolerant data at the scheduler. Through simulations, we show that the proposed approach successfully reduces the queuing delay by 93% for the packets of delay-sensitive (urgent) messages and the Packet Loss Rate (PLR) by 7% when compared to the benchmark where no aggregation mechanism exists prior to the small cell base stations.