The remarkable preservation of carbonaceous microfossils in Precambrian chert has been attributed to rapid silica precipitation enclosing original cellular carbon. However, while silicification of bacteria can preserve cellular morphology, in modern silicifying environments, organic molecules are rapidly destroyed after death, raising questions about the origin of carbon in ancient microfossils. Here, we show that carbonaceous matter in filamentous microfossils in chert from the Carboniferous Red Dog Zn-Pb deposit, northern Alaska, represents relicts of migrated oil. Black, carbonaceous microfossils are associated with chert stained brown by solidified oil surrounding hairline fractures. The black filaments contain thin carbon films (<50 nm) lining minute quartz crystals in intracellular cavities. Our observations indicate that silica nucleation on bacterial cell walls was followed by the decomposition of cellular carbon, producing silica-encased, bacterial molds that were later infiltrated by oil. This process represents a new mode of fossilization that raises questions about the origin of carbonaceous matter in some of Earth’s oldest microfossils.