How to select optimal threshold which separate different classes?
Rank all your instances by their output value. Then for each instance (or for each different output value, if many instances have the same value), calculate the performance (precision, recall, f-score) considering that the threshold is the output value for this instance. When this is done for all the instances, you can plot the graph of f-score as a function of the threshold for a nice visual result, or simply pick the threshold corresponding to the maximum performance.

For the record, this is also how a ROC curve can be built manually.

Btw your optimal threshold is certainly lower than 0.5, since your precision is 1.0 at 0.5 but you can probably still increase recall.