EXCLUSIVE. 1:50 PM PT – TMZ has learned Ralphie died at a private residence in Vegas Friday morning.

We’re told he had been battling pneumonia for 6 weeks and died of cardiac arrest.

He had performed Thursday night at Harrah’s in Vegas.

Comedian Ralphie May died Friday at the age of 45 … TMZ has learned.

Ralphie had been battling pneumonia over the last week, but kept performing his scheduled gigs in Las Vegas.

Ralphie’s stand-up comedy career took off after he finished second on “Last Comic Standing” in 2003.

Since then he’s had several televised comedy specials – mostly on Netflix and Comedy Central – and he’s continued touring, almost nonstop, around the country.

Ralphie was devastated by the split and the ensuing custody battle over their 2 kids, April June May and August James May..