it sounds like a logic board / bad internal video connection/card. if you can output to a screen through external, then maybe the inside connections are just loose
could be one of the ribbon cables is coming lose due to temperature change or maybe getting bumped around. have you disassembled to make sure everything is in good working order?
look in your connectors and make sure nothing is jammed in there like dirt or something to prevent a connection. A bad connection from the connector on the device will not be fixed with a new cable. as for replacing the port, it would be very difficult to just change it out. maybe you can see what hole has an issue by looking for a lack of conductor inside them. DVI runs in a few different modes with different pinouts, it sounds like your on a DVI-A for an analog signal but I havent see what the DVI-D signals do with limited pins connected.