The sentence with the direct object pronoun would be: "La compro en la estación de servicio."
In this case, "la" is the direct object pronoun used to replace "la gasolina" because "gasolina" is a feminine singular noun. In Spanish, direct object pronouns agree in gender and number with the noun they replace. Since "gasolina" is feminine and singular, we use "la" as the pronoun.