Thanking fellow PhD students in a paper I am just about to send a paper for publication, and I would be grateful for some advice on how I should acknowledge my fellow PhD students.

The paper in question is my own, in the sense that I am the only author. However, it is clear that science does not happen in vacuum, and it was helpful to have an informal discussion with my collegues from time to time. For instance, I would explain to them the outline of the argument, and they would see if they see an obvious error, or suggest that I use a well-know theorem which might be applicable, or ask a question about a possible generalisation.

What would be an appropriate form of acknowledgement? Is it generally a good idea to add a line like

"The author wishes to thank his fellow PhD students [insert a list of ~5 names here]" 

in the acknowledgements section? On one hand, I feel it's best to err on the side of being too polite, but on the other hand I'm not sure if it won't come across as name-dropping or trying to win favor.

If this is relevant, my field is (pure) mathematics.
The acknowledgements section of a paper is a perfect place to thank people who significantly aided you with the paper, but not to the level where authorship is merited.  

Unlike the acknowledgements of your thesis, however, the tradition of such sections is generally to be somewhat more strict in the notion of direct and material contributions: you should not be thanking your dog here.  So, for example, if your officemate actually read and critiqued the paper, acknowledgement is appropriate, but if they just helped to keep your spirits up, acknowledgement is not appropriate.

(I am answering from the general traditions of computer science, which are related but may not be quite the same as your area of mathematics)