A shortage of medics and a surge in heat-related 911 calls left the city struggling to respond to medical emergencies last week – and the dangerous situation could worsen as summer intensifies and more FDNY EMS workers jump ship to become firefighters, sources told The Post.

Dozens of ailing people waited more than an hour for a response after dialing 911 last week. During one two-hour period on a sweltering afternoon, six calls were stacked up for more than an hour, and 12 were delayed more than 30 minutes, according to Emergency Medical Service dispatch records reviewed by The Post.

A shrinking work force strained to respond to a flood of about 15,000 calls over four days – the same amount the city of Boston averages in a month. On a normal working day, the city’s 2,000 emergency medical technicians, paramedics and their supervisors get about 3,200 medical calls.

But last week demand spiked abruptly, going as high as 4,606 during one 24-hour period as temperatures sizzled. Eight people suffered heat-related deaths last week, the city medical examiner said. The sudden surge left dozens of calls queuing in EMS dispatch centers in The Bronx and Brooklyn. An overheated 65-year-old woman with high blood pressure waited nearly two hours for a crew.

Medics didn’t reach a 37-year-old woman suffering from vomiting and stomach pains for an hour and 14 minutes.

Critical calls regarding cardiac arrest and difficulty breathing are prioritized, but even those response times over the four days were higher than usual, department records show, rising from a citywide average of six minutes, 30 seconds to about seven minutes, 20 seconds.

City officials scrambled to cover gaps by rejiggering the overtime schedule and allowing EMTs to work back-to-back eight-hour shifts.

But EMS’s staffing shortage – now a chronic problem due to a starting wage of only $27,000 for EMTs and attrition rates of 20 percent – will only get more acute as summer wears on, sources said.

EMS is slated to lose 85 members – 17 of them highly trained paramedics – on July 1, when they transfer into the firefighter ranks. That leaves a gap of 1,700 additional eight-hour shifts a month.

Fire Commissioner Nicholas Scoppetta last month acknowledged to the City Council that he’d rely on overtime shifts to fill vacancies this summer.