I had a similar problem. I cleaned out the socket.I used a small screwdriver, few Q-tips. Just clean the contacts the best you can, then dab a little Dielectric grease, replace bulb. Otherwise you might have to replace the socket.
RepairPal Certified shops can diagnose and repair your 2007 Dodge Ram 1500. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.