In a book called “My Best Science Fiction Story”, published in 1949, the author John Taine, referring to his story “The Ultimate Catalyst”, writes that the story is “my favorite s-f story”. The story was first published in 1939. I’ve always thought “sf” was a later usage.
It's complicated because using "SF" as short for "Science Fiction" is just one of several closely-related initialisms used. These included "S. F.", "S-F" (and "s-f"), "Stf", and finally "SF". (Most of the information following comes from Jeff Prucher's Brave New Words (2008).)
The earliest use of anything in the family seems to date from 1929 in a letter to the editor of Science Wonder Stories, though it was still considered as an abbreviation and written "S. F." (It's not clear whether the letter writer or the editor did the abbreviating.)
The first use of "s-f" was in 1939 in a letter in Thrilling Wonder Stories.
The first use Brave New Words cites for "SF" was 1965 in a book review in Analog, but I'm pretty sure this is not the first.
"stf" is an early use first seen in 1931 in a letter to Wonder Stories. (FYI, "stf" is an abbreviation for "scientifiction" which was an early alternative to "science fiction" favored by Hugo Gernsback as a name for the genre.)
According to the German Wikipedia entry on Science-Fiction
Der Begriff wurde erstmals 1851 von dem britischen Dichter und Essayisten William Wilson (ca. 1826–1886) in der Überschrift von Kapitel 10 seines Buches A little earnest book upon a great old subject als „Science-Fiction“ eingeführt und, so der Schriftsteller Felix J. Palma in seinem Buch Die Landkarte der Zeit, von dem luxemburgisch-amerikanischen Erfinder, Schriftsteller und Verleger Hugo Gernsback im April 1926 in seiner Zeitschrift Amazing Stories als „scientifiction“ verwendet sowie ab 1929 in der endgültigen Form „science fiction“ als Genrebezeichnung etabliert. Bereits im August 1923 hatte er eine Sondernummer seines Magazins „Science and Invention“ als Scientific Fiction Number herausgegeben. 1929 ist das Lehnwort Science-Fiction in Werbungen für das Magazin Air Wonder Stories belegt. Die Abkürzung sci-fi ist von 1955.
the expression Science-Fiction was invented by William Wilson in 1851, the final form science fiction was established in 1929. The abbrevation sci-fi is from 1955.
Or did you just want to know since when "sf" was used to abbrevate science fiction? This could be almost untraceable because it is very likely that several authors did use it inside texts after they wrote the complete term once, but not as an official label.