The terminally ill fan Eminem visited over the weekend, passed away Monday afternoon ... just about 24 hours after he got to meet his favorite rapper.

17-year-old Gage Garmo -- who was battling a rare type of bone cancer called Osteosarcoma -- died the day after Em arranged a secret visit to Gage's home Sunday ... and spent an hour talking and hanging out with him.

Gage's family said the visit really raised his spirits.