could be a number of different issues. you could be looking at a bad power brick, putting a draw on it is shorting it somehow, causing it to kick off. it could be a bad charging circuit on the board, i had a similar issue out of my G51, had to replace the board. my advice would be to get the power brick tested at a electronics repair shop. that'll tell you if the problem is the brick or something internal with the computer. then you can decide if it's worth it to replace the board.
it's not super hard to do, but it's not the easiest thing in the world either. you need to be comfortable disassembling the laptop almost completely. when i did mine, the replacement board was about $100.
i recently had a intermittent issue, the problem turned out to be a grounding screw that had worked it's way loose, and a ram chip that had a bad trace on it. tightening down the screw somewhat fixed the issue and replacing the ram stick completely fixed it. what i'm getting at is it can be hard to diagnose a issue like yours without really digging into the matter.