Milan were in disarray during a calamitous first 45 minutes and came into the break 3-0 down following goals from Guillermo Giacomazzi, a Massimo Oddo penalty and Carlos Grossmuller.
But Boateng came off the bench to fire a 14-minute treble and Yepes headed home seven minutes from time to earn Massimiliano Allegri’s team an unlikely victory.
“It was very important that we could win this game, it was unbelievable, we came back, I scored three goals,” said the man-of-the-match.
“It’s a very good day for me, I will take this ball home and put it in an important place in my house.
“I was a bit injured on the knee and I think the coach wanted to give me a bit of a rest but we didn’t play well in the first half so he told me to go out and try my best.
“I’m very happy we won the game because it hasn’t been easy for us this season but this win shows we can come back and we worked very hard.
“I just try to work and play well, there are always negative people but I just look forwards. What’s in the past is in the past, I don’t think about this any more.”
The champions were without centre-back Thiago Silva and had Philippe Mexes on the bench having played just a few minutes since his return from a knee injury following six months on the sidelines.
And the champions could not have missed the pair more as they were a defensive shambles in the first period.
Milan’s backline was nowhwere to be seen after just four minutes as Giacomazzi managed to head home Grossmuller’s cross from inside the six yard box, beating hesitant goalkeeper Christian Abbiati to the ball.
Lecce were more than matching their listless visitors and soon extended their advantage.
The second came from the penalty spot after Abbiati was adjudged to have brought down Daniele Corvia as Milan failed in their attempts to clear a corner.
Television replays suggested the referee got that decision wrong as Corvia was on his way down before any contact with Abbiati happened.
But up stepped Oddo, who was released by Milan in the summer, to smash the spot-kick high past his former teammate on the half hour.
Milan looked to respond and Massimiliano Benassi had to tip a dipping volley from Antonio Nocerino over the bar.
And yet Milan’s defence still could not shut up shop and Lecce added a third before half-time.
First Mark van Bommel lost out in a 50-50 challenge, then Yepes dived in when he should have stayed on his feet and finally Luca Antonini inadvertently teed up Grossmuller, who would otherwise have been in an offside position, to prod the ball past Abbiati.
Milan’s defence may have been at sixes and sevens but it was the midfield that paid the price at half-time.
Alberto Aquilani was brought on for veteran captain Massimo Ambrosini while Robinho made way for Boateng in the trequartista role between forwards and midfield.
That move paid instant dividends as Boateng had pulled back two goals within 10 minutes.
He had already come close with two lashed efforts when Lecce failed to clear a corner and Aquilani clipped the ball back into the danger zone where Boateng fired home left footed into the top corner.
Minutes later he took aim again, this time from outside the box, and sent a missile into the opposite top corner.
The Ghana international completed his 14-minute hat-trick when Lecce again failed to clear their lines and he fired home inside Benassi’s near post from the edge of the six-yard box.
It was the fastest triple since David Trezeguet score a 10-minute hat-trick for Juventus 10 years ago.
The winner came in the dying moments as Lecce’s frail backline crumbled again and Antonio Cassano lofted the ball to the back post where Yepes outjumped Christian Obodo.