If the beer had been fully carbonated and then went flat you have a leak somewhere. A keg is a sealed and pressurized vessel and is designed to stay that way until it is vented. If the co2 escaped and then drained your co2 tank it's leaking.
But yes, once you figure it all out you can hook the keg back up and force carbonate it all over again. Be sure to check all your fittings and lines, give everything a spray of star san and check for bubbles leaking out after you get some new co2. Check all your posts and gaskets and line connections, something is leaking.