Should I apply for PhD with a 4 on my master thesis?
You  should apply, for the  following reasons:


First, you really  want  to do  a PhD. This should  be reason #1
A PhD is an adequation between a candidate, an advisor and a subject (possibly  a team), thus:
Grades matter, but adequation is more important. And you have timelessness.


A MSc is a first time test into research, but: 


The topics are often not the same. You can excel in a PhD, while having performed modestly in a MSc. The  converse may happen, too, because:
MSc and PhD are quite different, require seemingly different skills