Weird... Try this, it should work as well - it has the offending st_as_sf() eliminated (the mask does not need to be of sf class, sfc is good enough for masking).
library(tidyverse)
library(sf)
borders <- readRDS(url("https://biogeo.ucdavis.edu/data/gadm3.6/Rsf/gadm36_IRN_0_sf.rds"))
DFgrid <- data.frame(
lon=c(59.25, 59.75, 60.25, 60.75, 61.25, 61.75, 57.25, 57.75, 58.25, 58.75, 59.25, 59.75, 60.25, 60.75, 61.25, 61.75, 62.25, 57.25, 57.75, 58.25, 58.75, 59.25, 59.75, 60.25, 60.75, 61.25, 61.75, 62.25, 62.75, 53.25),
lat=c(25.25, 25.25, 25.25, 25.25, 25.25, 25.25, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 25.75, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.25, 26.75),
value= rnorm(30)
)
mask <- borders %>%
st_bbox() %>%
st_as_sfc() %>%
st_buffer(5) %>%
st_difference(borders)
my_year <- theme_bw() + theme(panel.ontop=TRUE, panel.background=element_blank())
my_fill <- scale_fill_distiller('',palette='Spectral',
breaks = c(-2,0,2))
fig = ggplot() + geom_tile(data = DFgrid, aes(y=lat, x=lon, fill=value)) + my_year + my_fill +
geom_sf(data = mask, fill = "white", color = NA) +
coord_sf(xlim=c(44.05, 63.35), ylim=c(25.05, 39.75)) +
borders('world', xlim=c(44.05, 63.35), ylim=c(25.05, 39.75), colour='black')+
xlab('Longitude (°E)')+ ylab('Latitude (°N)')+
theme(panel.grid=element_blank(),
panel.border = element_rect(colour = "black", fill=NA,size=.7))
print(fig)